diff --git a/Leetcode-Easy/9-PalindromeNumber/9-PalindromeNumber b/Leetcode-Easy/9-PalindromeNumber/9-PalindromeNumber new file mode 100644 index 0000000..7abef33 --- /dev/null +++ b/Leetcode-Easy/9-PalindromeNumber/9-PalindromeNumber @@ -0,0 +1,16 @@ +class Solution { +public: + bool isPalindrome(int x) { + string s = to_string(x); + int start = 0; + int end = s.length() - 1; + + while(start < end) + { + if(s[start++] != s[end--]) + return false; + } + + return true; + } +};