ง่าย 0 ข้อที่แก้แล้ว อัตราผ่าน 0%

Palindrome Number

Check whether a number reads the same backwards.

Decide 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.

เงื่อนไข

-10¹⁸ ≤ n ≤ 10¹⁸

ตัวอย่าง

ตัวอย่างที่ 1
อินพุต:
n = 12321

ผลลัพธ์ที่คาดหวัง:
expected = True
อินพุต:
long long n = 12321;

ผลลัพธ์ที่คาดหวัง:
bool expected = true;
อินพุต:
long n = 12321;

ผลลัพธ์ที่คาดหวัง:
bool expected = true;

คำอธิบาย

12321 reversed is 12321.

ตัวอย่างที่ 2
อินพุต:
n = -121

ผลลัพธ์ที่คาดหวัง:
expected = False
อินพุต:
long long n = -121;

ผลลัพธ์ที่คาดหวัง:
bool expected = false;
อินพุต:
long n = -121;

ผลลัพธ์ที่คาดหวัง:
bool expected = false;

คำอธิบาย

The minus sign makes "-121" differ from "121-".

แหล่งอ้างอิง

โจทย์นี้ปรับให้เหมาะกับ CodeUtility กรุณาทำตามคำชี้แจงและข้อจำกัดด้านบน

เรียนรู้จากคนอื่น

แนวทางจากชุมชน

ยังไม่มีวิธีทำที่เผยแพร่ ลองแก้โจทย์นี้เพื่อแชร์วิธีแรก