Simple Code found in Contest Ranking
credit : @DylanSmith\n# Code\n\nclass Solution {\npublic:\n    long long minimumCost(vector<int>& nums) {\n        int n = nums.size();\n        sort(nums.begin
`` credit : @DylanSmith ``\n# Code\n```\nclass Solution {\npublic:\n    long long minimumCost(vector<int>& nums) {\n        int n = nums.size();\n        sort(nums.begin(),nums.end());\n    \n        int median = nums[n/2];\n        int med1 = median;\n        int med2 = median;\n        \n        while(!palindrome(med1)) med1--;\n        while(!palindrome(med2)) med2++;\n        \n        long long ans1 = check(nums,med1);\n        long long ans2 = check(nums,med2);\n        \n        return min(ans1,ans2);\n        \n    }\n   long long check(vector<int>& nums,int x){\n        long long cost = 0;\n        for(auto &i:nums){\n            cost += abs(i - x);\n        }\n        return cost;\n    }\n    bool palindrome(int num){\n        string str = to_string(num);\n        int i = 0, j = str.size()-1;\n        while(i < j){\n            if(str[i++] != str[j--]){\n                return false;\n            }\n        }\n        return true;\n        \n    }\n};\n```
['C++']