Easy C++ solution
Intuition\n    Firstly, I thought about finding the average to get minimum deviation palindromic number but it gave wrong answer, then I moved to median and fou
# Intuition\n    Firstly, I thought about finding the average to get minimum deviation palindromic number but it gave wrong answer, then I moved to median and found that it solves my problem.\n\n# Approach\n    Simple, just sort the input array and then find median, then look for first occurrence of palindromic numbers both above and below this median by incrementing and decrementing the value, then this gives possible candidates, now just calculate the min cost.\n\n# Complexity\n- Time complexity:\n    O (NlogN)\n\n- Space complexity:\n\n    O (1)\n\n# Code\n```\nclass Solution {\npublic:\n    //Approach - Use median then find both less than and greater than first palindrome numbers then return min of both\n    \n    long long reverse(long long t){\n        long long ans = 0;\n        while(t>0){\n            ans += t%10;\n            ans *= 10;\n            t /=10;\n        }\n        return ans/10;\n    }\n\n    int upPalindrome(int m){\n        while(m!=reverse(m))\n            m++;\n        return m;\n    }\n\n    int downPalindrome(int m){\n        while(m!=reverse(m))\n            m--;\n        return m;\n    }\n\n    long long minimumCost(vector<int>& nums) {\n        long long cost1 = 0,cost2 = 0;\n        \n        sort(nums.begin(),nums.end());\n        int n = nums.size();\n\n        long long median;\n        if((n&1)==1) median =(n+1)/2;\n        else median =  n/2;\n\n        long long y1 = downPalindrome(nums[median-1]);\n        long long y2 = upPalindrome(nums[median-1]);\n\n        for(int x:nums) cost1 += abs(x-y1);\n        for(int x:nums) cost2 += abs(x-y2);\n\n        return min(cost1,cost2);\n    }\n};\n```
['C++']