Palindrome Number
Hi , guys ! My code seems to not be correct enough to unlock the third hidden test . Can someone please help . #include <iostream> using namespace std; bool isPalindrome(int x) { //complete the function // calculate and store the number of digits in the number input int Total = 0 ; int count = 0 ; int digit = x ; int * arrDigits ; // count the number of digits arrDigits = new int [count ] ; while ( x > 0 ) { digit = x % 10 ; count ++ ; arrDigits[count] = digit ; x= x/10 ; } // store the digits in array respectively Total = count ; count += 1 ; // check if the number remains the same when reversed for ( int a =0 ; a <= Total ; a ++) { int Arrdigit2 = arrDigits[count --] ; int Arrdigit1 = arrDigits[a] ; if (Arrdigit2 == 0 || Arrdigit1 ==0) { continue ; } if ( Arrdigit1 == Arrdigit2 ) { return true ; } else { return false ; } } } int main() { int n; cin >>n; if(isPalindrome(n)) { cout <<n<<" is a palindrome"; } else { cout << n<<" is NOT a palindrome"; } return 0; }