Skip to content

Practice Find the Count of Good Integers

Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.

Hard#3272
LeetCode Problem

Find the Count of Good Integers

Problem Statement

Given n and k, count n-digit positive integers whose digits can be rearranged into a palindrome divisible by k. Neither the original integer nor the rearranged palindrome may have a leading zero. Count each original integer once.

Source: Find the Count of Good Integers on LeetCode. Use the original task for its coding environment and submissions.

Examples

# Example 1

Input
n = 3, k = 5
Output
27

# Example 2

Input
n = 1, k = 4
Output
2

# Example 3

Input
n = 5, k = 6
Output
2468

Constraints

1 <= n <= 10
1 <= k <= 9

Related LeetCode Problems

Practice more problems similar to Find the Count of Good Integers.

Review your practice with PhantomCodeAI

After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.