LeetCode MEDIUM 1922 Count Good Numbers Summary
Generated by Codex with GPT-5
Quick facts
- Difficulty:
MEDIUM - Problem: Count Good Numbers
- Topics:
Math,Recursion
Problem gist
The problem asks for the number of length-n digit strings that satisfy two position rules:
- Digits at even indices can be one of
0,2,4,6, or8. - Digits at odd indices can be one of
2,3,5, or7.
Indices are zero-based, so index 0 is even. The string can start with 0; this is a digit string, not a normal integer representation. Because the answer can be enormous, return it modulo 1_000_000_007.