Easy to understand JavaScript solution (Prefix Sum)
Complexity\n- Time complexity:\nO(n + limit)\n\n- Space complexity:\nO(limit)\n\n# Code\n\nvar minMoves = function(nums, limit) {\n    const moves = Array(2 + l
# Complexity\n- Time complexity:\n$$O(n + limit)$$\n\n- Space complexity:\n$$O(limit)$$\n\n# Code\n```\nvar minMoves = function(nums, limit) {\n    const moves = Array(2 + limit * 2).fill(0);\n    const size = nums.length;\n    let current = 0;\n    let result = size;\n\n    for (let index = 0; index < size / 2; index++) {\n        const a = Math.min(nums[index], nums[size - 1 - index]);\n        const b = Math.max(nums[index], nums[size - 1 - index]);\n\n        moves[2] += 2;\n        moves[a + 1] -= 1;\n        moves[a + b] -= 1;\n        moves[a + b + 1] += 1;\n        moves[b + limit + 1] += 1;\n    }\n    for (let index = 2; index <= limit * 2; index++) {\n        current += moves[index];\n        result = Math.min(current, result);\n    }\n    return result;\n};\n```
['JavaScript']