Icons are numbered 1 to 26, and a list of icons is stored by writing their numbers one after another, so (1, 12) becomes "112". Some digits of an old code were smudged and are now written as *. Each * stands for one digit from 1 to 9 (never 0).
Write countBlankReadings(code) that returns how many icon lists could have produced code, counting every way to fill in the * digits and every way to split the result into numbers from 1 to 26 without leading zeros.
Return the count modulo 1000000007.
Input: code = "*2" Output: 11
9 readings as two icons (any digit, then 2), plus 12 and 22 as single icons.
Input: code = "*7" Output: 10
9 readings as two icons, plus 17 as one icon (27 is too big).
1 <= code.length <= 300000code contains digits and *.Run tries your code on the examples. Submit runs every test, including hidden edge cases and big inputs that check your code is fast enough, and solves the problem when they all pass.
Ctrl + Enter runs, Ctrl + Shift + Enter submits (⌘ on a Mac).
I'm here to help with #502 Icon Codes With Blanks. I give hints, never the solution, so you get to solve it yourself. Ask for a hint, select code to ask about it, or press Ask Tuto why on a failing test.
Your first 3 answers need no account. for free to keep asking.