deno.land / x / masx200_leetcode_test@10.6.5 / triangle / index.ts

نووسراو ببینە
1
2
3
4
5
6
7
8
9
10
11
12
13
14
export default function minimumTotal(triangle: number[][]): number { const bottom = triangle[triangle.length - 1];
let dp = bottom;
for (let i = dp.length - 2; i >= 0; i--) { dp = dp.map((v, j, a) => { return Math.min(v, a[j + 1]) + triangle[i][j]; }); dp.length--; } return dp[0];}
masx200_leetcode_test

Version Info

Tagged at
a year ago