Leetcode 2217. Find Palindrome With Fixed Length
For each query k, return the k-th smallest positive palindrome with exactly intLength digits (no leading zeros), or -1 if fewer than k palindromes exist. This is solved by enumerating the valid first half (starting from 10^{half-1}) and mirroring it—adjusting for odd/even lengths—and checking if k exceeds the total count.
Question Timeline
See when this question was last asked and where, including any notes left by other candidates.
0
Hello Interview Premium
Your account is free and you can post anonymously if you choose.