deno.land / x / masx200_leetcode_test@10.6.5 / ba-shu-zi-fan-yi-cheng-zi-fu-chuan-lcof / index.ts

نووسراو ببینە
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
function translateNum(num: number): number { const s = String(num);
const n = s.length;
const dp = [1, 1];
for (let i = 2; i < n + 1; i++) { const o = Number(s[i - 2] + s[i - 1]);
dp[2] = dp[1] + Number(9 < o && o < 26) * dp[0]; dp.shift(); } return dp[1];}export default translateNum;
masx200_leetcode_test
leetcode题解和一些测试工具
DocumentationDocumentation
GitHub Repositorymasx200/leetcode-test
GitHub Stars
4

Version Info

Tagged at
4 months ago