comefrom: <doocs>0768.Max Chunks To Make Sorted II_1.py
code: def maxChunksToSorted( arr: List[int]) -> int:
      stk = []
      for v in arr:
          if not stk or v >= stk[-1]:
              stk.append(v)
          else:
              mx = stk.pop()
              while stk and stk[-1] > v:
                  stk.pop()
              stk.append(mx)
      return len(stk)
masked: def sample_funcname ( var_0 : List [ int ] ) -> int :
      var_3 = [ ]
      for var_4 in var_0 :
          if not var_3 or var_4 >= var_3 [ - 1 ] :
              var_3.append ( var_4 )
          else :
              var_8 = var_3.pop ( )
              while var_3 and var_3 [ - 1 ] > var_4 :
                  var_3.pop ( )
              var_3.append ( var_8 )
      return len ( var_3 )
  