Palindrome number

PHOTO EMBED

Thu Jun 23 2022 18:17:34 GMT+0000 (Coordinated Universal Time)

Saved by @Ranjan_kumar #c++

class Solution {
public:
    bool isPalindrome(int x) {
        string s1=to_string(x);
      string s=to_string(x);
        int n=s.length();
        for(int i=0;i<n/2;i++)
        {
            swap(s[i],s[n-1-i]);
        }
        if(s1==s) return true;
        else return false;
    }
};
content_copyCOPY

https://leetcode.com/problems/palindrome-number/