[Hyun] Week 12 Solution Explanation #193
Merged
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.
300. Longest Increasing Subsequence
Complexities ๐
Explanation ๐
์ฒ์์๋ DP๋ก ํ์์ผ๋, ์ด๋ถํ์(Binary Search)์ผ๋ก ๊ฐ์ ํ์ต๋๋ค.
์ฒ์์๋ ์ฒซ ๋ฒ์งธ ์์๋ฅผ
tails
๋ผ๋lis
๋ฐฐ์ด์ ๋ฃ๊ณ ๊ทธ ๋ค๋ถํฐ ๊ฐ ์์๋ฅผ ๋น๊ตํฉ๋๋ค.tails์ ๋ง์ง๋ง๊ฐ๋ณด๋ค ์ฃผ์ด์ง number๊ฐ ํฐ ๊ฒฝ์ฐ lis๋ฐฐ์ด์ธ
tails
๊ฐ ๋ ๊ธธ์ด์ง ์ ์๊ธฐ์,tails
๋ฐฐ์ด ๋ฐ๋ก ๋ค์ number๋ฅผ ์ถ๊ฐํฉ๋๋ค.๋ง์ฝ ๊ทธ๋ฌ์ง ์๋ค๋ฉด,
tails
์ ์ด๋ ๋ถ๋ถ์ ์ ์ ํ๊ฒ ๋ค์ด๊ฐ ์ ์๋๋กBinary Search
๋ก ์ธ๋ฑ์ค๋ฅผ ๊ตฌํฉ๋๋ค.์ด ๋ฐฉ๋ฒ์ ์ค์ LIS ์์ด์ ๊ตฌ์ฑํ์ง ์๊ณ ๊ธธ์ด๋ง์ ํจ์จ์ ์ผ๋ก ๊ณ์ฐํฉ๋๋ค.
62. Unique Paths
Complexities ๐
Explanation ๐
๋ก๋ด์ ์์น์๋ถํฐ ์์๋๋ ์ ๋ถ 1๋ก ์ค์ ํ๊ณ , ๋ก๋ด์ ๋จ๋์ชฝ ๋๊ฐ์ ํ์นธ๋ถํฐ dp๋ฅผ ์์ํ์ฌ ํ์ดํ์ต๋๋ค.
1143. Longest Common Subsequence
Complexities ๐
Explanation ๐
์ฌ๊ณ ๋ฅผ ํ์ฅํ๋ ๊ฒ ์ข ์ด๋ ค์ ์ต๋๋ค. ๐ฅฒ ์๊ณ ๋ฌ๋ ํ์ด ๋ณด๊ณ ํด๊ฒฐํ์ต๋๋ค.
53. Maximum Subarray
Complexities ๐
Explanation ๐
๋ค์ ๊ฒ์ ๋ํ ๊ฒ๊ณผ ๋ค์ ๊ฐ ์์ฒด์ ํฌ๊ธฐ ๊ด๊ณ๋ฅผ ๋น๊ตํ์ฌ ํ์ดํ์ต๋๋ค.
55. Jump Game
Complexities ๐
Explanation ๐
์๊ฐ์ ์ ํ์ผ๋ก Goal -> 0๋ฒ์งธ ์ธ๋ฑ์ค๋ก ๊ฐ๋ ๊ฒ์ผ๋ก ํ์ดํ์ต๋๋ค.