?LeetCode刷題實(shí)戰(zhàn)120: 三角形最小路徑和
Given a triangle, find the minimum path sum from top to bottom. Each step you may move to adjacent numbers on the row below.
題意
解題
class?Solution?{
????public?int?minimumTotal(List> triangle
) {
????????int?row = triangle.size();
????????Listres = new?LinkedList<>(triangle.get(row - 1));
????????for?(int?i = row - 2; i >= 0; i--) {
????????????ListcurrentRow = triangle.get(i);
????????????for?(int?j = 0; j < currentRow.size(); j++) {
????????????????res.set(j, Math.min(res.get(j), res.get(j + 1)) + currentRow.get(j));
????????????}
????????}
????????return?res.get(0);
????}
}
LeetCode刷題實(shí)戰(zhàn)113:路徑總和 II
LeetCode刷題實(shí)戰(zhàn)114:二叉樹(shù)展開(kāi)為鏈表
LeetCode刷題實(shí)戰(zhàn)115:不同的子序列
LeetCode刷題實(shí)戰(zhàn)116:填充每個(gè)節(jié)點(diǎn)的下一個(gè)右側(cè)節(jié)點(diǎn)指針
LeetCode刷題實(shí)戰(zhàn)117:填充每個(gè)節(jié)點(diǎn)的下一個(gè)右側(cè)節(jié)點(diǎn)指針 II
LeetCode刷題實(shí)戰(zhàn)118:楊輝三角
LeetCode刷題實(shí)戰(zhàn)119: 楊輝三角 II

