Skip to main content

Practice · 2 of 3

Contains Seven

CHALLENGE
Difficulty: advanced+25 XP

**Problem.** Line 1: q. Each line: L R. Print one integer per line: the count of x in [L, R] whose decimal representation contains the digit 7. **Constraints:** 1 ≤ q ≤ 1000; 1 ≤ L ≤ R ≤ 10^18. Count the complement (numbers with NO 7) via the 9^k free table, then subtract.

Back to lesson: Practice: Digit Trio