Decode Ways II
Solve this the way you would in the interview: out loud, on a timer, with an AI interviewer asking follow-ups while you code. You get a scored report at the end.
Practice this as a mock interviewFree to start, no account neededProblem
Letters are encoded as numbers: 'A' is 1, 'B' is 2, and so on up to 'Z' = 26. The string s is an encoded message made of digits and the wildcard '*'. Each '*' can stand for any digit from 1 to 9 (never 0).
Count the ways to split s into codes from 1 to 26, counting every choice of wildcard digits. A code never has a leading zero: "06" is not a valid code, and a lone "0" cannot be decoded.
Return the count modulo 10^9 + 7.
Examples
Constraints
- 1 <= s.length <= 10^5
- `s[i]` is a digit or `'*'`
What the interviewer grades
A correct solution is one of five scores. The report also grades problem understanding (did you clarify inputs and edge cases before coding), problem solving, communication while you work, code quality, and testing. See a sample report, or read up on the pattern in the lessons.