906. Super Palindromes Hard
1/**
2 * [906] Super Palindromes
3 *
4 * Let's say a positive integer is a super-palindrome if it is a palindrome, and it is also the square of a palindrome.
5 * Given two positive integers left and right represented as strings, return the number of super-palindromes integers in the inclusive range [left, right].
6 *
7 * Example 1:
8 *
9 * Input: left = "4", right = "1000"
10 * Output: 4
11 * Explanation: 4, 9, 121, and 484 are superpalindromes.
12 * Note that 676 is not a superpalindrome: 26 * 26 = 676, but 26 is not a palindrome.
13 *
14 * Example 2:
15 *
16 * Input: left = "1", right = "2"
17 * Output: 1
18 *
19 *
20 * Constraints:
21 *
22 * 1 <= left.length, right.length <= 18
23 * left and right consist of only digits.
24 * left and right cannot have leading zeros.
25 * left and right represent integers in the range [1, 10^18 - 1].
26 * left is less than or equal to right.
27 *
28 */
29pub struct Solution {}
30
31// problem: https://leetcode.com/problems/super-palindromes/
32// discuss: https://leetcode.com/problems/super-palindromes/discuss/?currentPage=1&orderBy=most_votes&query=
33
34// submission codes start here
35
36impl Solution {
37 pub fn superpalindromes_in_range(left: String, right: String) -> i32 {
38 0
39 }
40}
41
42// submission codes end
43
44#[cfg(test)]
45mod tests {
46 use super::*;
47
48 #[test]
49 fn test_906() {
50 }
51}
52
Back
© 2025 bowen.ge All Rights Reserved.