(str, index, memo)
| 19 | }; |
| 20 | |
| 21 | const dfs = (str, index, memo) => { |
| 22 | let count = numDecodings(str, index + 1, memo); |
| 23 | |
| 24 | if (isTwoDigit(str, index)) { |
| 25 | count += numDecodings(str, index + 2, memo); |
| 26 | } |
| 27 | |
| 28 | memo.set(index, count); |
| 29 | |
| 30 | return count; |
| 31 | }; |
| 32 | |
| 33 | var isTwoDigit = (str, index) => { |
| 34 | const twoDigit = Number(str.slice(index, index + 2)); |
no test coverage detected