c++函数reverse();用来将数组、字符串、容器逆序。
需要头文件
#include
class Solution {
public:
bool isPalindrome(int x) {
string t=to_string(x);
reverse(t.begin(),t.end());
return t==to_string(x);
}
};
link.

c++函数reverse();用来将数组、字符串、容器逆序。
需要头文件
#include
class Solution {
public:
bool isPalindrome(int x) {
string t=to_string(x);
reverse(t.begin(),t.end());
return t==to_string(x);
}
};
link.