My Blog List

[Leetcode Solution] Jump Game

Analysis 

  • Simply maintain two variables p and q representing the current position and the farthest position where can be reached seperately.
  • Iterate the p if p<=q, and update q if the further place can be reached from the p

Note

Code


No comments:

Post a Comment

Enter you comment