Skip to content

Commit

Permalink
chore: lint
Browse files Browse the repository at this point in the history
  • Loading branch information
whewchews committed Aug 30, 2024
1 parent 3c26ea7 commit c0d6bb0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
7 changes: 3 additions & 4 deletions coin-change/whewchews.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@ function coinChange(coins: number[], amount: number): number {
* coins๋ฅผ ์ˆœํšŒํ•˜๋ฉด์„œ ๋ˆ„์ ์•ก์— ๋™์ „์„ ๋”ํ•œ ๊ฐ’์ด amount๋ณด๋‹ค ์ž‘์œผ๋ฉด queue์— ๋„ฃ๋Š”๋‹ค.
* queue๊ฐ€ ๋นŒ๋•Œ๊นŒ์ง€ ๋ฐ˜๋ณต
* ํ๊ฐ€ ๋น„์–ด์žˆ๊ณ  amount๋ฅผ ๋งŒ๋“ค์ˆ˜ ์—†์œผ๋ฉด -1์„ return
*/
const queue = [[0, 0]]; // [number of coins, accumulated amount]
*/ const queue = [[0, 0]]; // [number of coins, accumulated amount]
const visited = new Set();

while (queue.length > 0) {
Expand All @@ -28,6 +27,6 @@ function coinChange(coins: number[], amount: number): number {
}
}
return -1;
// TC: ๊ฐ ๊ธˆ์•ก(amount)๋งˆ๋‹ค ๋™์ „(coins)์„ ์ˆœํšŒํ•˜๋ฏ€๋กœ O(N*M) N: amount, M: coins.length
// SC: O(N) N: amount
}
// TC: ๊ฐ ๊ธˆ์•ก(amount)๋งˆ๋‹ค ๋™์ „(coins)์„ ์ˆœํšŒํ•˜๋ฏ€๋กœ O(N*M) N: amount, M: coins.length
// SC: O(N) N: amount
2 changes: 1 addition & 1 deletion combination-sum/whewchews.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,4 +120,4 @@ function combinationSum(candidates: number[], target: number): number[][] {
}

// TC: O(C * T * K)
// SC: O((T+1) * K* T)
// SC: O((T+1) * K* T)

0 comments on commit c0d6bb0

Please sign in to comment.