comefrom: <doocs>2134.Minimum Swaps to Group All 1's Together II_1.py
code: def minSwaps( nums: List[int]) -> int:
      cnt = nums.count(1)
      n = len(nums)
      s = [0] * ((n << 1) + 1)
      for i in range(n << 1):
          s[i + 1] = s[i] + nums[i % n]
      mx = 0
      for i in range(n << 1):
          j = i + cnt - 1
          if j < (n << 1):
              mx = max(mx, s[j + 1] - s[i])
      return cnt - mx
masked: def sample_funcname ( var_0 : List [ int ] ) -> int :
      var_5 = var_0.count ( 1 )
      var_7 = len ( var_0 )
      var_9 = [ 0 ] * ( ( var_7 << 1 ) + 1 )
      for var_11 in range ( var_7 << 1 ) :
          var_9 [ var_11 + 1 ] = var_9 [ var_11 ] + var_0 [ var_11 % var_7 ]
      var_12 = 0
      for var_11 in range ( var_7 << 1 ) :
          var_13 = var_11 + var_5 - 1
          if var_13 < ( var_7 << 1 ) :
              var_12 = max ( var_12 , var_9 [ var_13 + 1 ] - var_9 [ var_11 ] )
      return var_5 - var_12
  