Practice Find the Largest Palindrome Divisible by K
Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.
Hard#3260
LeetCode ProblemFind the Largest Palindrome Divisible by K
Problem Statement
Given positive integers n and k, return the largest n-digit decimal palindrome divisible by k. Return it as a string, with no leading zeros.
Source: Find the Largest Palindrome Divisible by K on LeetCode. Use the original task for its coding environment and submissions.
Examples
# Example 1
Input
n = 3, k = 5
Output
"595"
# Example 2
Input
n = 1, k = 4
Output
"8"
# Example 3
Input
n = 5, k = 6
Output
"89898"
Constraints
1 <= n <= 10^5
1 <= k <= 9
Related LeetCode Problems
Practice more problems similar to Find the Largest Palindrome Divisible by K.
Review your practice with PhantomCodeAI
After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.