A solution to Codility's FrogJump