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.
π λ¬Έμ λ§ν¬
κ΅¬κ° λλκΈ°
βοΈ μμλ μκ°
1μκ°(30λΆ μ§λ³΄λ€κ° μΈν°λ·μ μμ΄λμ΄ μ°Έκ³ ..)
β¨ μλ μ½λ
μΌλ¨ μ λ² PRμμ λμ¨ μ±νλμ λμ ν© λ¬Έμ κ° μμ΄μ μ΄ λ¬Έμ λ₯Ό λ€κ³ μλλ° λμ ν DPλ‘λ μκ°μ΄ μλλλΌκ΅¬μ...
κ·Έλμ μΈν°λ·μ μ‘°κΈ μ°Έκ³ ν΄μ νμμ΅λλ€.
μΌλ¨ μμ΄λμ΄λ λκ°μ DP λ°°μ΄μ λ§λλλ€!!!
κ·Έλ κ² λ§λ λκ°μ λ°°μ΄μ
1 -> ν΄λΉ indexλ₯Ό ν¬ν¨ν λ°°μ΄
2 -> ν΄λΉ indexλ₯Ό ν¬ν¨νμ§ μμ λ°°μ΄
μλ₯Ό λ€μ΄
-1, 3, 1, 2, 4 -1 μ΄ μμΌλ©΄
μ μ¬μ§κ³Ό κ°μ΄
con[i][1]μλ νμ¬κΉμ§ μ 체 λμ ν©μ΄ λ€μ΄κ°κ³
notcon[i][1]μλ ν΄λΉ μΈλ±μ€(i)λ₯Ό μ μΈν λμ ν©μ΄ λ€μ΄κ°λλ€.
κ·Έλ¦¬κ³ 2κ°μ mκ°μ ꡬκ°μ΄ μμ΄μΌνλκΉ μμ μλ 2λ‘ λ€μ΄μμ
dp1[i][2]μλ dp1[i-1][j]κ³Ό dp2[i-1][j-1] μ λ μ€ ν° κ°μ νμ¬ μΈλ±μ€μ κ°μ΄ λ€μ΄κ°λλ€.
dp2[i][2]μλ dp1[i-1][j]μ dp2[i-1][j] λΉκ΅ν΄μ λ€μ΄κ°κ² λ©λλ€.
μ λ μ΄λΆλΆμ κΈλ‘λ§ λ³΄λ©΄ μ΄λ €μ μλλ°
3λ²λΆν° μλ₯Ό λ€λ©΄
con -> max(dp2(-1), dp1(f)), + 1(i)μ΄ μ ν
con -> max(dp2(3), dp1(0)), + 2(i)κ° μ ν
μ΄λ κ² μ λ΄λ €κ°μ
dp1, dp2μ n,mμΈλ±μ€μ€ ν° κ°μ μΆλ ₯νμ΅λλ€.
μ½λ
π μλ‘κ² μκ²λ λ΄μ©
μ°Έκ³ λΈλ‘κ·Έ
dpμμ μ νμμ μΈμ°λκ² μμ§ μ°Έ μ΄λ ΅λ€κ³ λλ μ΄λ€ μ°κ΄μ±μΌλ‘ μ§λ λΆλΆμ΄ μμ§ λ§μ΄ λΆμ‘±...