#ECMAScript6, 67 * 0.5 = 33.5 bytes#
ECMAScript6, 67 * 0.5 = 33.5 bytes
f=n=>{a=[],b=0;while(c=n+b,n--){while(c-b)a.push(c--);b++}return a}
Pretty happy with this one...It's about a quarter the size of my original.
f(4)
returns:
[ 4, 3, 2, 1, 4, 3, 2, 4, 3, 4 ]
Old answer:
f=i=>{a=b=Array;while(i)a=a.concat(b.apply(null,b(i)).map(e=>i)),i--;return a}
This is my first shot at code golf...I still want to get that 0.5x bonus. Any suggestions are welcomed!
Called with f(n).