Skip to content

Commit 6b0871d

Browse files
committed
Add 9-PalindromeNumber.cpp
1 parent efa381e commit 6b0871d

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
class Solution {
2+
public:
3+
bool isPalindrome(int x) {
4+
5+
int y(x);
6+
int test(0);
7+
while(y > 0){test = 10 * test + (y % 10); y /= 10;}
8+
return (test == x);
9+
}
10+
};

0 commit comments

Comments
 (0)