Python solution with explanation
the logic is that we try to calculate the interval for each pair if we make one move\n * the interval is [min(nums[i],nums[n-i-1])+1, max(nums[i],nums[n-i-1])+l
* the logic is that we try to calculate the interval for each pair if we make one move\n * the interval is [min(nums[i],nums[n-i-1])+1, max(nums[i],nums[n-i-1])+limit]\n * we only record the interval boundaries and calculate the number of overlapped invervals in one-pass\n \nfrom collections import defaultdict\nclass Solution:\n\n    def minMoves(self, nums: List[int], limit: int) -> int:\n        sum_count = defaultdict(int)\n        m = len(nums)//2\n        interval = [0]*(2*limit+2)\n        for i in range(m): # calculate the interval boundaries\n            s = nums[i]+nums[len(nums)-1-i]\n            sum_count[s]+=1\n            interval[min(nums[i],nums[len(nums)-1-i])+1]+=1\n            interval[max(nums[i],nums[len(nums)-1-i])+limit+1]-=1\n        ans = float("inf")\n        for i in range(1,len(interval)): \n            interval[i]+=interval[i-1]\n            ans = min(ans, 2*(m-interval[i])+interval[i]-sum_count[i])\n        return ans
['Python']