comefrom: <doocs>1871.Jump Game VII_1.py
code: def canReach( s: str, minJump: int, maxJump: int) -> bool:
      n = len(s)
      dp = [False] * n
      dp[0] = True
      pre_sum = [0] * (n + 1)
      pre_sum[1] = 1
      for i in range(1, n):
          if s[i] == '0':
              l = max(0, i - maxJump)
              r = i - minJump
              if r >= l and pre_sum[r + 1] - pre_sum[l] > 0:
                  dp[i] = True
          pre_sum[i + 1] = pre_sum[i] + dp[i]
      return dp[n - 1]
masked: def sample_funcname ( var_0 : str , var_2 : int , var_4 : int ) -> bool :
      var_7 = len ( var_0 )
      var_9 = [ False ] * var_7
      var_9 [ 0 ] = True
      var_13 = [ 0 ] * ( var_7 + 1 )
      var_13 [ 1 ] = 1
      for var_15 in range ( 1 , var_7 ) :
          if var_0 [ var_15 ] == '0' :
              var_18 = max ( 0 , var_15 - var_4 )
              var_19 = var_15 - var_2
              if var_19 >= var_18 and var_13 [ var_19 + 1 ] - var_13 [ var_18 ] > 0 :
                  var_9 [ var_15 ] = True
          var_13 [ var_15 + 1 ] = var_13 [ var_15 ] + var_9 [ var_15 ]
      return var_9 [ var_7 - 1 ]
  