leecode55跳跃游戏

设计成一个函数
是否能从某个位置跳到最后
%设计一个函数,从某个位置调到最后,从0跳到某个位置
%0只能往前跳
%最简单的字问题,能否从子问题
重复的子问题可以不去去执行

def dp(i:int)->bool
   if i >=n-1:return True 
   if i +nums[]>=n-1: True
   for s in range(1,nums[i]+1):
      if dp(i+s):
      return True
   return False   

你可能感兴趣的:(django,python,后端)