Solution
C++ []\nstatic const auto fast = []() {ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); return 0; } ();\nclass Solution {\npublic:\n    int minMoves(v
```C++ []\nstatic const auto fast = []() {ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); return 0; } ();\nclass Solution {\npublic:\n    int minMoves(vector<int>& nums, int limit) {\n        int n=nums.size(),c2[2*limit+2],c3[2*limit+1],ans=n,t1,t2;\n        memset(c2,0,sizeof(c2));\n        memset(c3,0,sizeof(c3));\n        for(int x=0;x<n/2;x++){\n            t1=min(nums[x],nums[n-1-x]);\n            t2=max(nums[x],nums[n-1-x]);\n            c2[t1+1]--;\n            c2[t2+limit+1]++;\n            c3[t1+t2]++;\n        }\n\n        int cnt=n;\n        for(int x=2;x<=2*limit;x++){\n            cnt+=c2[x];\n            ans=min(ans,cnt-c3[x]);\n        }\n\n        return ans;\n    }   \n};\n```\n\n```Python3 []\nclass Solution:\n    def minMoves(self, nums: List[int], limit: int) -> int:\n        moves, n = [0] * (2 * limit), len(nums)\n        for l, r in zip(nums[:n // 2], nums[::-1]):\n            if l > r:\n                l, r = r, l\n            moves[l - 1] -= 1\n            moves[l + r - 2] -= 1\n            moves[l + r - 1] += 1\n            moves[r + limit - 1] += 1\n        return n + min(accumulate(moves))\n```\n\n```Java []\nclass Solution {\n    public int minMoves(int[] nums, int limit) {\n         int n = nums.length;\n        int[] diff = new int[2 * limit + 2];\n        for(int i = 0; i < n / 2; i++){\n            int a = nums[i];\n            int b = nums[n - 1 - i];\n            diff[2] += 2;\n            diff[Math.min(a, b) + 1]--;\n            diff[a + b]--;\n            diff[a + b + 1]++;\n            diff[Math.max(a, b) + limit + 1]++;\n        }\n        int res = n;\n        int curr = 0;\n        for(int i = 2; i <= 2 * limit; i++){\n            curr += diff[i];\n            res = Math.min(res, curr);\n        }\n        return res;\n    }\n}\n```\n
['C++', 'Java', 'Python3']