Code Room
CodingHard
Question
Given a non-negative integer n, count how many integers x with 0 <= x <= n have NO two adjacent digits equal in their usual base-10 representation (e.g. 11 and 122 are invalid; 121 and 5 are valid; single-digit numbers including 0 are valid). 0 <= n <= 10^9. Return the count.
Implement
count_no_adjacent_equal(n: int) → intExamples
in
[22]out21What a strong answer looks like
State your approach and its time/space complexity out loud before you optimize. Handle the edge cases (empty input, duplicates, overflow), and say why you chose this over the brute force. Green tests are the floor, not the grade.
Learn the concepts
Vibe coding: describe the solution in plain language (or narrate it) and the coach grades your approach. Generating runnable code from your description is coming next.
Run or narrate your approach, then ask the coach.