Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
๐ฑWIL
๐์ฃผ๊ฐ ๋ชฉํ ๋ฌธ์ ์: 5๊ฐ
๋ฐฑ์ค #10026. ์ ๋ก์์ฝ: DFS/BFS / ๊ณจ๋5
์ ๋ฆฌํ ๋งํฌ: ๋ฐ๋ก๊ฐ๊ธฐ
๐ฉํ๋ก์ฐ (์ ํ)
๐ฉ์ ์ถํ ์ฝ๋
๐กTIL
๋ฐฑ์ค #4963. ์ฌ์ ๊ฐ์: DFS/BFS / ์ค๋ฒ2
์ ๋ฆฌํ ๋งํฌ: ๋ฐ๋ก๊ฐ๊ธฐ
๐ฉํ๋ก์ฐ (์ ํ)
visited๋ฐฐ์ด ์์ด 1โ0์ผ๋ก ๋ฐ๊พธ์ด ํ์์ ์ฒ๋ฆฌ ํ ์ ์๋ค๐ฉ์ ์ถํ ์ฝ๋
๐กTIL
๋ฐฉํฅ๋ฒกํฐ (ํ๊ณผ ์ด ๊ด์ ์์ ์ขํ๋ฅผ ์ด๋ํ๋ ๋ฐฉ์)
dx[i],dy[i]๋ฅผ ์ฌ์ฉํ์ฌ ๋ฐ๋ณต๋ฌธ์ผ๋ก ํ์ํ๋ฉด ์ฝ๋๋ฅผ ๋จ์ํ๊ฒ ๋ง๋ค ์ ์๋ค.queue = deque([(x, y)]),queue.append((nx, ny)): ๋ฆฌ์คํธ ์์ ํํ ์ฒ๋ฆฌํด์ ์ถ๊ฐํด์ฃผ์ด์ผ ํ๋ค.๋ฐฑ์ค #14430. ์์ ์บ๊ธฐ: DP / ์ค๋ฒ2
์ ๋ฆฌํ ๋งํฌ: ๋ฐ๋ก๊ฐ๊ธฐ
๐ฉํ๋ก์ฐ (์ ํ)
dp[i][j]:(i, j)๊น์ง ๋๋ฌํ์ ๋ ์ต๋ ์์ ๊ฐ์(i, j)์ ๋์ฐฉํ์ ๋ ๊ฐ๋ฅํ ๋ ๊ฐ์ง ๊ฒฝ๋ก๋ ๋ค์๊ณผ ๊ฐ๋ค.(i-1, j)์์ ์๋๋ก ๋ด๋ ค์จ ๊ฒฝ์ฐ(i, j-1)์์ ์ค๋ฅธ์ชฝ์ผ๋ก ์ด๋ํ ๊ฒฝ์ฐdp[i][j] = max(dp[i-1][j], dp[i][j-1]) + grid([i][j])์ด๋ค.dp[0][j]์dp[i][0]์ ๊ฐ๊ฐ ์ฒซ ํ๊ณผ ์ฒซ ์ด์ด๋ฏ๋ก ์ด๊ธฐํ๊ฐ ํ์ํ๋ค.dp[0][0] = grid[0][0]dp[0][j] = dp[0][j-1] + grid[0][j]dp[i][0] = dp[i-1][0] + grid[i][0]๐ฉ์ ์ถํ ์ฝ๋
๐กTIL
๋ฐฑ์ค #2503. ์ซ์ ์ผ๊ตฌ: ๊ตฌํ / ์ค๋ฒ3
์ ๋ฆฌํ ๋งํฌ: ๋ฐ๋ก๊ฐ๊ธฐ
๐ฉํ๋ก์ฐ (์ ํ)
๐ฉ์ ์ถํ ์ฝ๋
๐กTIL
permutations(range(1,10), 3): 1~9๊น์ง ์๋ก ๋ค๋ฅธ ์ซ์ 3๊ฐ๋ฅผ ๋ฝ๋ ์์ด(Permutation)์คํธ๋ผ์ดํฌ์ ๋ณผ์ ๊ณ์ฐํ๋ ํจ์
์คํธ๋ผ์ดํฌ ๊ณ์ฐ:
sum(a == b for a, b in zip(num1, num2))zip(num1, num2): ๋ ์ซ์๋ฅผ ์๋ฆฌ๋ณ๋ก ๋ฌถ์ด์ ๋น๊ตํ๋ค.sum()์ ์ฌ์ฉํ์ฌ True ๊ฐ์๋ฅผ ๊ตฌํ๋ค.๋ณผ ๊ณ์ฐ:
sum(a in num2 for a in num1) - strikenum1์ ๊ฐ ์ซ์๊ฐnum2์ ํฌํจ๋์ด ์๋์ง๋ฅผ ์ฒดํฌํ๋ค. (์์๋ ๋ฌด๊ดํ๋ค.)๊ฒฐ๊ณผ(
strike,ball)๊ฐ ์ง๋ฌธ์q_strike,q_ball๊ณผ ๋ค๋ฅด๋ฉด ๋ถ๊ฐ๋ฅํ ์ซ์์ด๋ฏ๋กvalid=False๋ก ์ค์ ํ๊ณ breakํ๋ค.๋ฐฑ์ค #2342. Dance Dance Revolution: DP / ๊ณจ๋3
์ ๋ฆฌํ ๋งํฌ: (๋ฐ๋ก๊ฐ๊ธฐ)
๐ฉ์ ์ถํ ์ฝ๋
๋ฐฑ์ค #2293. ๋์ 1: DP / ๊ณจ๋4
๐ฉ์ ์ถํ ์ฝ๋