Leetcode day1

This commit is contained in:
2026-01-25 12:41:33 +05:30
parent 686d174f19
commit 245116d181
14 changed files with 168 additions and 0 deletions
+14
View File
@@ -0,0 +1,14 @@
class Solution{
public:
bool isPalindrome(int x){
int rev = 0;
if(x<0 || x%10 == 0 && x!=0){
return false;
}
while(x>rev){
rev = (rev*10) + (x%10);
x/=10;
}
return ( x==rev || x = rev/10);
}
}