Problème
Afficher la traductionDecide whether the decimal digits of n read the same forwards and backwards. Negative numbers are never palindromes because of the minus sign.
Implement is_palindrome_number(n).
Input
n: The number to check.
Output
Return true for a palindromic number, otherwise false.
Contraintes
-10¹⁸ ≤ n ≤ 10¹⁸
Exemples
Exemple 1
Entrée :
n = 12321
Sortie attendue :
expected = True
Entrée :
long long n = 12321;
Sortie attendue :
bool expected = true;
Entrée :
long n = 12321;
Sortie attendue :
bool expected = true;
Explication
12321 reversed is 12321.
Exemple 2
Entrée :
n = -121
Sortie attendue :
expected = False
Entrée :
long long n = -121;
Sortie attendue :
bool expected = false;
Entrée :
long n = -121;
Sortie attendue :
bool expected = false;
Explication
The minus sign makes "-121" differ from "121-".
Références
Ce défi a été adapté pour CodeUtility. Suivez l'énoncé et les contraintes ci-dessus.