#APL (4)
APL (4)
¯A⌽B
- A is the number of places to rotate
- B is the name of the array to be rotated
I'm not sure if APL actually required it, but in the implementation I've seen (the internals of) this would take time proportional to A
, and constant memory.