Skip to main content
Commonmark migration
Source Link

#JavaScript (ES6), 57 bytes

JavaScript (ES6), 57 bytes

n=>(g=k=>n--?[p+=p<k|g[p-k]?k:-k,...g(g[p]=k+1)]:[])(p=0) 

Try it online!

#JavaScript (ES6), 57 bytes

n=>(g=k=>n--?[p+=p<k|g[p-k]?k:-k,...g(g[p]=k+1)]:[])(p=0) 

Try it online!

JavaScript (ES6), 57 bytes

n=>(g=k=>n--?[p+=p<k|g[p-k]?k:-k,...g(g[p]=k+1)]:[])(p=0) 

Try it online!

Source Link
Arnauld
  • 205.5k
  • 21
  • 187
  • 670

#JavaScript (ES6), 57 bytes

n=>(g=k=>n--?[p+=p<k|g[p-k]?k:-k,...g(g[p]=k+1)]:[])(p=0) 

Try it online!