Pre-compute pair sums obtainable in 1 move
\nclass Solution:\n    def minMoves(self, nums: List[int], limit: int) -> int:\n        n = len(nums)\n        i, j = 0, n - 1\n        vals = Counter()\n      
```\nclass Solution:\n    def minMoves(self, nums: List[int], limit: int) -> int:\n        n = len(nums)\n        i, j = 0, n - 1\n        vals = Counter()\n        freq = [0] * (2 * limit + 2)\n        while i < j:\n            a, b = min(nums[i], nums[j]), max(nums[i], nums[j])\n            vals[a + b] += 1\n            freq[a + 1] += 1\n            freq[b + limit + 1] -= 1\n            i += 1\n            j -= 1\n        for i in range(2 * limit + 1):\n            freq[i + 1] += freq[i]\n        res = float(\'inf\')\n        for i in range(2, 2 * limit + 1):\n            one = freq[i] - vals[i]\n            two = n // 2 - freq[i]\n            res = min(res, one + 2 * two)\n        return res\n```
['Python']