#12Ancient Vault Code
Given an integer code, determine whether it reads the same from left to right and right to left. Return true if the code is a palindrome; otherwise, return false. Negative numbers are not considered valid because the negative sign would appear at the opposite end when the number is reversed.
Real-World Applications: Security Code Validation; Symmetric Pattern Detection; Data Integrity Checking;
Examples
Example 1
Input: 9229
Output: true
Explanation:
9229 reads the same forward and backward.
Example 2
Input: 252
Output: true
Explanation:
252 reads the same forward and backward.
Constraints
- -2^31 <= code <= 2^31 - 1
- code is a valid 32-bit signed integer.