Easy Solution || Beats 90%
Intuition\nIncrement and Decrement the median value till you find a palindrome sequence each and calculate the respective scores for each of them\n\n\n# Complex
# Intuition\nIncrement and Decrement the median value till you find a palindrome sequence each and calculate the respective scores for each of them\n\n\n# Complexity\n- Time complexity: O(NlogN)\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution {\npublic:\n    bool isPalindrome(int n){\n        string s=to_string(n);\n        int i=0,j=s.size()-1;\n        while(i<=j){\n            if(s[i++]!=s[j--])return false;\n        }\n        return true;\n    }\n    int dec(int x){\n        while(!isPalindrome(x)){\n            x++;\n        }\n        return x;\n    }\n    int inc(int x){\n        while(!isPalindrome(x)){\n            x--;\n        }\n        return x;\n    }\n    long long val(int a,vector<int> nums){\n        long long ans=0;\n        for(int i:nums){\n            ans+=abs(i-a);\n        }\n        return ans;\n    }\n    long long minimumCost(vector<int>& nums) {\n        int n=nums.size();\n        sort(begin(nums),end(nums));\n        \n        int a=inc(nums[n/2]);\n        int b=dec(nums[n/2]);\n        \n        return min(val(a,nums),val(b,nums));\n        \n    }\n};\n```
['C++']