class Solution {
public:
/**
* @param A: A list of integers
* @return: The boolean answer
*/
bool func(vector<int> A, int i, int size)
{
if (i >= size - 1)
return true;
int t = A[i];
while (t > 0)
{
if (func(A, t + i, size))
return true;
t--;
}
return false;
}
bool canJump(vector<int> A) {
// write you code here
int size = A.size();
int i = 0;
return func(A, i, size);
}
};