apple pie's submission of Can You Reach The End | CodeChef