Advertisement
nikunjsoni

55

Jun 29th, 2021
147
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.22 KB | None | 0 0
  1. class Solution {
  2. public:
  3.     bool canJump(vector<int> A) {
  4.         int i = 0, n = A.size();
  5.         for (int reach = 0; i < n && i <= reach; ++i)
  6.             reach = max(i + A[i], reach);
  7.         return i == n;
  8.     }
  9. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement