Skip to content

[week3] 가장 가까운 조상#23

Open
ShinHyeongcheol wants to merge 5 commits intoSOPT-all:mainfrom
ShinHyeongcheol:week3/hyeongcheol-shin
Open

[week3] 가장 가까운 조상#23
ShinHyeongcheol wants to merge 5 commits intoSOPT-all:mainfrom
ShinHyeongcheol:week3/hyeongcheol-shin

Conversation

@ShinHyeongcheol
Copy link

@ShinHyeongcheol ShinHyeongcheol commented Dec 9, 2025

문제

백준 3584번 가장 가까운 조상

문제 설명

루트 트리가 주어지고, 입력 받은 두 숫자의 부모 트리 중 가장 가까운 공통 조상을 찾기

풀이

  1. 각각의 노드에 대한 입력받기
  2. parent와 child 입력
  3. 부모노드로 가면서 A에 대한 visited 확인
  4. 3의 과정을 B로 반복해주면서 visited 확인
  5. 방문한 결과가 있다면 결과에 저장
  6. 결과 출력

@ShinHyeongcheol ShinHyeongcheol changed the title [Week3] 가장 가까운 조상 [week3] 가장 가까운 조상 Dec 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant