Python3 O(limit) solution tracking intervals
\nclass Solution:\n    def minMoves(self, nums: List[int], limit: int) -> int:\n      arrs = [0]*(limit*2 + 2)\n      n = len(nums)\n      for i in range(n//2):
```\nclass Solution:\n    def minMoves(self, nums: List[int], limit: int) -> int:\n      arrs = [0]*(limit*2 + 2)\n      n = len(nums)\n      for i in range(n//2):\n        v1, v2 = nums[i], nums[-1-i]\n        #we need 2 moves if target in [2, left_bound) \n        #        1 move  if target in [left_bound, v1 + v2)\n        #        0 move  if target in [v1 + v2, v1 + v2 + 1)\n        #        1 move  if target in [v1 + v2 + 1, right_bound]\n        #        2 moves if target in (right_bound, limit*2]\n        left_bound = min(v1 + 1, v2 + 1)\n        right_bound = max(v1 + limit, v2 + limit)\n        #modify prefix array\n        arrs[v1 + v2] -= 1\n        arrs[v1 + v2 + 1] += 1\n        arrs[left_bound] -= 1\n        arrs[right_bound + 1] += 1 \n      \n      #get the mininum prefix sum and add base n to it\n      return n + min([prefix for prefix in itertools.accumulate(arrs)])\n```
[]