File tree Expand file tree Collapse file tree 1 file changed +3
-4
lines changed Expand file tree Collapse file tree 1 file changed +3
-4
lines changed Original file line number Diff line number Diff line change @@ -8,8 +8,7 @@ function coinChange(coins: number[], amount: number): number {
8
8
* coins를 순회하면서 누적액에 동전을 더한 값이 amount보다 작으면 queue에 넣는다.
9
9
* queue가 빌때까지 반복
10
10
* 큐가 비어있고 amount를 만들수 없으면 -1을 return
11
- */
12
- const queue = [ [ 0 , 0 ] ] ; // [number of coins, accumulated amount]
11
+ */ const queue = [ [ 0 , 0 ] ] ; // [number of coins, accumulated amount]
13
12
const visited = new Set ( ) ;
14
13
15
14
while ( queue . length > 0 ) {
@@ -28,6 +27,6 @@ function coinChange(coins: number[], amount: number): number {
28
27
}
29
28
}
30
29
return - 1 ;
31
- // TC: 각 금액(amount)마다 동전(coins)을 순회하므로 O(N*M) N: amount, M: coins.length
32
- // SC: O(N) N: amount
33
30
}
31
+ // TC: 각 금액(amount)마다 동전(coins)을 순회하므로 O(N*M) N: amount, M: coins.length
32
+ // SC: O(N) N: amount
You can’t perform that action at this time.
0 commit comments