Python 3 || 6 lines, two pointers || T/S: 58% / 98%
\nclass Solution:\n    def minimumCost(self, nums: List[int]) -> int:\n        \n        nums.sort()\n        pal = lambda x: str(x) == str(x)[::-1]\n        le
```\nclass Solution:\n    def minimumCost(self, nums: List[int]) -> int:\n        \n        nums.sort()\n        pal = lambda x: str(x) == str(x)[::-1]\n        left = rght = nums[len(nums)//2]\n\n        while not pal(left): left-= 1\n        while not pal(rght): rght+= 1\n\n        return min(sum(map(lambda x: abs(x - left), nums)),\n                   sum(map(lambda x: abs(x - rght), nums)))\n```\n[https://leetcode.com/problems/minimum-cost-to-make-array-equalindromic/submissions/1295778192/\n](https://leetcode.com/problems/minimum-cost-to-make-array-equalindromic/submissions/1295778192/)\n\n\nI could be wrong, but I think that time complexity is *O*(*N* log *N*) and space complexity is *O*(1), in which *N* ~ `len(nums)`.
['Python3']