Class Solution
-
- All Implemented Interfaces:
public final class Solution
906 - Super Palindromes.
Hard
Let's say a positive integer is a super-palindrome if it is a palindrome, and it is also the square of a palindrome.
Given two positive integers
left
andright
represented as strings, return the number of super-palindromes integers in the inclusive range[left, right]
.Example 1:
Input: left = "4", right = "1000"
Output: 4
Explanation:: 4, 9, 121, and 484 are superpalindromes. Note that 676 is not a superpalindrome: 26 \* 26 = 676, but 26 is not a palindrome.
Example 2:
Input: left = "1", right = "2"
Output: 1
Constraints:
1 <= left.length, right.length <= 18
left
andright
consist of only digits.left
andright
cannot have leading zeros.left
andright
represent integers in the range <code>1, 10<sup>18</sup> - 1</code>.left
is less than or equal toright
.
-
-
Constructor Summary
Constructors Constructor Description Solution()
-
Method Summary
Modifier and Type Method Description final Integer
superpalindromesInRange(String left, String right)
-
-
Method Detail
-
superpalindromesInRange
final Integer superpalindromesInRange(String left, String right)
-
-
-
-