Algorithm · Microsoft · Medium
A base-10 integer is a decimal palindrome when its digit sequence is identical read left-to-right and right-to-left. Implement two functions: isPalindrome(n: int) -> bool: returns true exactly when n is a decimal palindrome. Do not convert n to a string. Negative integers always produce false. nextPalindrome(n: int) -> int: returns the smallest palindrome strictly larger than n. You may assume n is non-negative and that the returned value fits in a 32-bit signed integer. For…
Checking your access…