RSL interview question

Data Structure Algorithm Java Puzzle