Skip to main content
added 378 characters in body
Source Link
loopy walt
  • 16.8k
  • 2
  • 11
  • 69

Python, 53 bytes ÷ 2 = 26.5

lambda n:[n-i%-~n%(i//n-~n)for i in range(n*~n//2,0)]

Attempt This Online!

Python 2 version, 51 bytes ÷ 2 = 25.5

lambda n:[n-i%-~n%(i/n-~n)for i in range(n*~n/2,0)]

Attempt This Online!

This uses ranges like many other answers here but groups them in pairs (longest,shortest);(2nd longest,2nd shortest) etc. That way we can use a closed form expression inside a flat loop.

Python, 53 bytes ÷ 2 = 26.5

lambda n:[n-i%-~n%(i//n-~n)for i in range(n*~n//2,0)]

Attempt This Online!

This uses ranges like many other answers here but groups them in pairs (longest,shortest);(2nd longest,2nd shortest) etc. That way we can use a closed form expression inside a flat loop.

Python, 53 bytes ÷ 2 = 26.5

lambda n:[n-i%-~n%(i//n-~n)for i in range(n*~n//2,0)]

Attempt This Online!

Python 2 version, 51 bytes ÷ 2 = 25.5

lambda n:[n-i%-~n%(i/n-~n)for i in range(n*~n/2,0)]

Attempt This Online!

This uses ranges like many other answers here but groups them in pairs (longest,shortest);(2nd longest,2nd shortest) etc. That way we can use a closed form expression inside a flat loop.

Source Link
loopy walt
  • 16.8k
  • 2
  • 11
  • 69

Python, 53 bytes ÷ 2 = 26.5

lambda n:[n-i%-~n%(i//n-~n)for i in range(n*~n//2,0)]

Attempt This Online!

This uses ranges like many other answers here but groups them in pairs (longest,shortest);(2nd longest,2nd shortest) etc. That way we can use a closed form expression inside a flat loop.