Search
⌘K

Leetcode 967. Numbers With Same Consecutive Differences

Generate all n-digit integers (no leading zeros) whose adjacent digits have absolute difference k — a digit-by-digit construction problem solvable by DFS/BFS from starting digits 1–9, where each step has at most two next-digit choices (digit ± k) and k=0 requires avoiding duplicates.


Question Timeline

See when this question was last asked and where, including any notes left by other candidates.

Comments

Your account is free and you can post anonymously if you choose.