triangle
This commit is contained in:
parent
807ce27309
commit
3cc60d0431
|
@ -0,0 +1,10 @@
|
|||
impl Solution {
|
||||
pub fn minimum_total(mut triangle: Vec<Vec<i32>>) -> i32 {
|
||||
for row in (0..triangle.len() - 1).rev() {
|
||||
for idx in 0..row + 1 {
|
||||
triangle[row][idx] += triangle[row + 1][idx].min(triangle[row + 1][idx + 1]);
|
||||
}
|
||||
}
|
||||
triangle[0][0]
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue