[Java] Prefix Sum + Suffix Sum Inspired by @lee215
I will try to give a quick explanation. Basically we first keep track how many pairs we don\'t have to change for each candidate target value using the counter 
I will try to give a quick explanation. Basically we first keep track how many pairs we don\'t have to change for each candidate target value using the counter array. For each pair, we consider two cases. One in which we need to decrease the larger of the pair to 1 in order to match the target value. Another in which we need to increase the smaller of the pair to limit to match the target value. Then we maintain an suffix counter array for the first case and an prefix counter array for the second case. Finally, we iterate through all possible candidate values and assume that for each iteration, we need 1 change for each pair, hence n / 2, then subtract the pairs that already matches the value, and then we add the extra moves from pairs that need further adjustments given by our prefix and suffix array (i.e, do we need to increase or decrease the other value). Hope that makes sense.\n```\nclass Solution {\n    public int minMoves(int[] nums, int limit) {\n        int[] cnt = new int[limit * 2 + 1];\n        int[] min = new int[limit * 2 + 1];\n        int[] max = new int[limit * 2 + 2];\n        int n = nums.length;\n        int res = Integer.MAX_VALUE;\n        for (int i = 0; i < n / 2; i++) {\n            cnt[nums[i] + nums[n - i - 1]]++;\n            min[Math.min(nums[i], nums[n - i - 1])]++;\n            max[Math.max(nums[i], nums[n - i - 1]) + limit + 1]++;\n        }\n        for (int i = limit * 2 - 1; i >= 2; i--) {\n            min[i] += min[i + 1];\n        }\n        for (int i = 3; i < limit * 2 + 1; i++) {\n            max[i] += max[i - 1];\n        }\n        for (int i = 2; i < limit * 2 + 1; i++) {\n            res = Math.min(res, n / 2 - cnt[i] + min[i] + max[i]);\n        }\n        return res;\n    }\n}\n```
['Prefix Sum']