File tree Expand file tree Collapse file tree 2 files changed +3
-22
lines changed
Expand file tree Collapse file tree 2 files changed +3
-22
lines changed Original file line number Diff line number Diff line change 1616
1717### 제출 일자
1818
19- 2025년 08월 30일 11:39:05
19+ 2025년 08월 30일 11:39:44
2020
2121### 문제 설명
2222
Original file line number Diff line number Diff line change 1- import java .util .*;
21class Solution {
32 public int solution (int [][] triangle ) {
4- int length = triangle .length ;
5-
6- int [][] dp = new int [length ][length ];
7- dp [0 ][0 ] = triangle [0 ][0 ];
8- for (int i = 1 ; i < length ;i ++){
9- int [] period = dp [i -1 ];
10- for (int j = 0 ; j < i +1 ; j ++ ){
11- int maxNum ;
12- if (j == 0 ){
13- maxNum = period [0 ];
14- } else maxNum = Math .max (period [j -1 ] , period [j ]);
15-
16- int current = triangle [i ][j ];
17- dp [i ][j ] = maxNum + current ;
18- }
19- }
20-
21- int [] lastDp = dp [length - 1 ];
22- int max = Arrays .stream (lastDp ).max ().orElse (0 );
23- return max ;
3+ int answer = 0 ;
4+ return answer ;
245 }
256}
You can’t perform that action at this time.
0 commit comments