C++ || easy to understand beat 92%
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\n\n// please upvote if found helpful\nclass Solution {\npublic:\n    \n    bool isPalindrome(long long i){\n        string s = to_string(i);\n        int j=0,k=s.size()-1;\n        \n        while(j<k){\n            if(s[j] != s[k])    return false;\n            j++,k--;\n        }\n        return true;\n    }\n    long long minimumCost(vector<int>& nums) {\n        sort(nums.begin(),nums.end());\n        int n = nums.size();\n        long long s=0; long long e= n-1;\n        long long midEl = nums[s+(e-s)/2];\n\n        long long x = midEl,y=midEl;\n        \n        while(isPalindrome(x) == 0){\n            x--;\n        }\n        long long int ans = 0;\n        for(int i=0; i<n; i++){\n            ans += abs(nums[i] - x);\n        }\n        while(isPalindrome(y) == 0){\n            y++;\n        }\n        long long int ans2 = 0;\n        for(int i=0; i<n; i++){\n            ans2 += abs(nums[i] - y);\n        }\n        \n        ans = min(ans,ans2);\n    \n        return ans;   \n    }\n    \n};\n// please upvote if found helpful\n```
['C++']