Skip to main content
3 of 3
Commonmark migration

JavaScript (ES6) 29 (58 * 0.5)

Edit remove ; thx @Optimizer

Q=o=>(m=>{for(n=o,r=[];n>m||++m<(n=o);)r.push(n--)})(0)||r

Test in FireFox/FireBug console

Q(9)

Output

[9, 8, 7, 6, 5, 4, 3, 2, 1, 9, 8, 7, 6, 5, 4, 3, 2, 9, 8, 7, 6, 5, 4, 3, 9, 8, 7, 6, 5, 4, 9, 8, 7, 6, 5, 9, 8, 7, 6, 9, 8, 7, 9, 8, 9]

Ungolfed

Q=o=>{
  for(m=0,r=[];m<o;++m)
    for(n=o;n>m;)
      r.push(n--);
  return r
}
edc65
  • 32.2k
  • 3
  • 36
  • 90