#2396
Medium Algorithms Strictly palindromic number
Math Two Pointers Brainteaser
90.2% acceptance
Feb 25, 2026
820
1759
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.
Solution
Rust
Time O(1)
Space O(1)
impl Solution {
pub fn is_strictly_palindromic(_n: i32) -> bool {
// For any n >= 4, in base n-2 the representation is "12"
// which is never a palindrome. So the answer is always false.
false
}
}