Algorithm to rotate an array in linear time | Hacker News Reader