nikunjsoni

55

Jun 29th, 2021
97
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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. };
RAW Paste Data