Clean C++
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```cpp []\nclass Solution {\nprivate:\n    bool is_palindromic(int n){\n        int copy_n = n;\n        int reverse = 0;\n        while(n > 0){\n            reverse = reverse * 10 + n % 10;\n            n /= 10;\n        }\n        return reverse == copy_n;\n    }\npublic:\n    long long minimumCost(vector<int>& nums) {\n        int n = nums.size();\n        if(n == 1){\n            int left_median = nums[0];\n            int right_median = nums[0];\n            while(!is_palindromic(left_median)) left_median--;\n            while(!is_palindromic(right_median)) right_median++;\n            return min(abs(nums[0]-left_median),abs(nums[0]-right_median));\n        }\n        sort(nums.begin(),nums.end());\n        int lower_median_index = (n + 1) / 2 - 1; \n        int upper_median_index = (n  + 2) / 2 - 1;\n        int median = (nums[lower_median_index] + nums[upper_median_index]) / 2;\n        int left_median = median;\n        int right_median = median;\n        while(!is_palindromic(left_median)) left_median--;\n        while(!is_palindromic(right_median)) right_median++;\n\n        long long sum1 = 0;\n        long long sum2 = 0;\n        for(auto n: nums){\n            sum1 += abs(left_median - n);\n            sum2 += abs(right_median - n);\n        }\n        return min(sum1,sum2);\n\n    }\n};\n```
['C++']