[Java] Clean line sweep solution :)
\nclass Solution {\n    public int minMoves(int[] nums, int limit) {\n        Map<Integer, Integer> map = new HashMap<>();\n        int[] line = new int[limit *
```\nclass Solution {\n    public int minMoves(int[] nums, int limit) {\n        Map<Integer, Integer> map = new HashMap<>();\n        int[] line = new int[limit * 2 + 2];\n        final int n = nums.length;\n        for (int i = 0, j = n - 1; i < j; i++, j--) {\n            int min = Math.min(nums[i], nums[j]) + 1;\n            int max = Math.max(nums[i], nums[j]) + limit;\n            line[min]++;\n            line[max + 1]--;\n            map.merge(nums[i] + nums[j], 1, Integer::sum);\n        }\n        int ret = n;\n        for (int i = 2, runningSum = 0; i < line.length; i++) {\n            runningSum += line[i];\n            int numChanges = n - runningSum - map.getOrDefault(i, 0);\n            ret = Math.min(ret, numChanges);\n        }\n        return ret;\n    }\n}\n\n```
['Java']