Problem Statement | |
John and Brus are studying string theory at the university. Their task is to create a list of all the palindromes that contain between 1 and n lowercase letters ('a'-'z'), inclusive. A palindrome is a string that reads the same forward and backward. Additionally, each palindrome in their list must contain no more than k distinct letters. Return the number of palindromes in the list modulo 1234567891.
| | Definition | | Class: | TheLongPalindrome | Method: | count | Parameters: | int, int | Returns: | int | Method signature: | int count(int n, int k) | (be sure your method is public) |
| | | | Constraints | - | n will be between 1 and 1,000,000,000, inclusive. | - | k will be between 1 and 26, inclusive. | | Examples | 0) | | | | Returns: 26 | All palindromes in the list are single character strings. |
|
| 1) | | | | Returns: 52 | Now we have single and double character palindromes. |
|
| 2) | | | | 3) | | | |
This problem statement is the exclusive and proprietary property of TopCoder, Inc. Any unauthorized use or reproduction of this information without the prior written consent of TopCoder, Inc. is strictly prohibited. (c)2024, TopCoder, Inc. All rights reserved.
|