2396. Strictly Palindromic Number
Medium
An integer n
is strictly palindromic if, for every base b
between 2
and n - 2
(inclusive), the string representation of the integer n
in base b
is palindromic.
Given an integer n
, return true
if n
is strictly palindromic and false
otherwise.
A string is palindromic if it reads the same forward and backward.
Example 1:
Example 2:
Constraints:
4 <= n <= 105
解題
對任何大於3的數字 n,它的 n-2 進制結果為 12 ,必然不回文。
例如 9 的 7 進制 為 12。
Last updated