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