Practice Sum of k-Mirror Numbers
Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.
Problem Statement
A k-mirror number is a positive integer without leading zeros that reads the same both forward and backward in base-10 as well as in base-k. Given the base k and the number n, return the sum of the n smallest k-mirror numbers.
Source: Sum of k-Mirror Numbers on LeetCode. Use the original task for its coding environment and submissions.
Examples
# Example 1
Input
k = 2, n = 5
Output
25
# Example 2
Input
k = 3, n = 7
Output
499
# Example 3
Input
k = 7, n = 17
Output
20379000
Constraints
2 <= k <= 9
1 <= n <= 30
Related LeetCode Problems
Practice more problems similar to Sum of k-Mirror Numbers.
Review your practice with PhantomCodeAI
After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.