Problem Statement
Palindromic Array | Practice | GeeksforGeeks
Pattern:
Solution
for (int num : nums) {
int temp = num, revNum = 0;
while(temp != 0) {
revNum = revNum*10 + temp%10;
temp /= 10;
}
if(revNum != num) return 0;
}
return 1;
Palindromic Array | Practice | GeeksforGeeks
Pattern:
for (int num : nums) {
int temp = num, revNum = 0;
while(temp != 0) {
revNum = revNum*10 + temp%10;
temp /= 10;
}
if(revNum != num) return 0;
}
return 1;