a simpler solution for jump game 2.