-
Notifications
You must be signed in to change notification settings - Fork 4
[JustDevRae] 25.02.22 #47
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Moonjonghoo
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
μ 체μ μΌλ‘ νμκ³Ό λ°°μ΄μ μ νμ©ν΄μ νμ΄μ£Όμ κ±°κ°μ΅λλ€!
κ³ μνμ
¨μ΅λλ€.
bona1122
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
μ½λ μ 보μμ΅λλ€. dfs,bfs,λ€μ΅μ€νΈλΌ λͺ¨λ μ μ΄μ©νμ κ² κ°μ΅λλ€! νμ£Όλμ μκ³ νμ ¨μ΅λλ€π
π νΌ λ¬Έμ
π κ°λ¨ν νμ΄ κ³Όμ
Find the Town Judge
κ° μ¬λμ μ λ’° μ μλ₯Ό λ°°μ΄μ μ§κ³ν ν, λ°°μ΄μ μννλ©° μ λ’° μ μκ° n - 1μΈ μ¬λμ μ°Ύμ λ°ννλ λ°©μμΌλ‘ ν΄κ²°νμ΅λλ€.
Find if Path Exists in Graph
edgesλ₯Ό μΈμ 리μ€νΈλ‘ λ³νν ν, BFS νλ₯Ό νμ©ν΄ μμ λ Έλμμ λͺ©ν λ ΈλκΉμ§ κ²½λ‘κ° μ‘΄μ¬νλμ§λ₯Ό νμνλ λ°©μμΌλ‘ ν΄κ²°νμ΅λλ€.
κ²μ λ§΅ μ΅λ¨κ±°λ¦¬
λ―Έλ‘ μ§λλ₯Ό 2μ°¨μ λ°°μ΄λ‘ ν΄μν ν, μ΄λ λ°©ν₯ λ°°μ΄μ μ΄μ©ν΄ BFSλ‘ μ΅λ¨ κ²½λ‘λ₯Ό νμνκ³ λμ°© μ§μ κΉμ§μ μ΄λ νμλ₯Ό κ³μ°νλ λ°©μμΌλ‘ ν΄κ²°νμ΅λλ€.
νκ² λλ²
μ«μ λ°°μ΄μ DFS κΈ°λ²μΌλ‘ μ¬κ· νμν ν, λͺ¨λ κ²½μ°μ μ μ€ λͺ©ν μ«μμ λλ¬νλ κ²½μ°λ₯Ό λμ νμ¬ μΉ΄μ΄νΈνλ λ°©μμΌλ‘ ν΄κ²°νμ΅λλ€.
λ°°λ¬
λλ‘ μ 보λ₯Ό κ·Έλνλ‘ κ΅¬μ±ν ν, λ€μ΅μ€νΈλΌ μκ³ λ¦¬μ¦μ νμ©ν΄ μμ λ§μμμ κ° λ§μκΉμ§μ μ΅λ¨ μ΄λ μκ°μ κ³μ°νκ³ , μ ν μκ° λ΄ λλ¬ κ°λ₯ν λ§μμ μλ₯Ό μ§κ³νλ λ°©μμΌλ‘ ν΄κ²°νμ΅λλ€.