leetcode/src/s0009_palindrome_number.cpp

9 lines
170 B
C++
Raw Normal View History

2022-11-02 14:20:09 +00:00
#include "s0009_palindrome_number.hpp"
bool Solution::isPalindrome(int x) {
string s = to_string(x);
string r = s;
reverse(r.begin(), r.end());
return s == r;
}