Won't work when reverse no. overflows the integer value


Comment body goes here.


It works!

int Solution::isPalindrome(int A) {
    int num = A;
    int rev = 0;
        int l = num%10;
        rev = rev*10 + l;
        num = num/10;
    // cout<<A<<" "<<rev<<endl;
    return (rev==A);


It will work because the reversed number will become negative due to overflow and it won’t be equal to the given number.