← All problemsSign in

3966. Count Good Integers in a Range

You are given three integers l, r and k. A number is considered good if the absolute difference between every pair of adjacent digits is at most k. Return the number of good integers in the range [l, r] (inclusive). The absolute difference between values x and y is defined as abs(x - y). Example 1: Input: l = 10, r = 15, k = 1 Output: 3 Explanation: - The good integers in the range are 1

HINT LADDERno hints yet
L1 Observation
L2 Technique
L3 Approach
L4 Pseudo-code
🔒
L5 Full solution
L5 unlocks only if you insist twice
solution.cppC++17

CodeSearch Tutor

Hints, not spoilers — it won’t hand over the full solution unless you insist.

voice by Sarvam AI

Sign in to chat with the tutor and save your progress.

Sign in to start