mac10

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);

}
};

分类:

技术点:

相关文章:

  • 2022-02-01
  • 2021-09-26
  • 2021-04-18
  • 2021-08-26
  • 2021-04-30
  • 2021-09-25
猜你喜欢
  • 2021-12-24
  • 2019-01-04
  • 2022-01-08
相关资源
相似解决方案