Memory Limit Exceeded Despite Super Low Footprint?

  • 0

    Despite using the leanest C++ solution I could come up with, not sure where else to reduce memory usage... thoughts?

    class Solution {
        bool isPalindrome(int x) {
            if (x < 0) return false;
            else if (x<10) return true;
            size_t rev=0;
            for(int l=x; l; l/=10) rev=rev*10+l%10;
            return (size_t)x == rev;

  • 0

    This was just fixed, could you please try again?

Log in to reply

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.