Leetcode 100문제 도전
[Leetcode 27/100] Clone Graph - Medium
Llife
2021. 1. 24. 02:10
leetcode.com/problems/clone-graph/
Clone Graph - LeetCode
Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview.
leetcode.com
문제 풀이 방식
해시 맵과 BFS를 활용하여 그래프를 한번만 탐색
주의할 점
1. 문제에서 주어진 요구사항은 deepCopy를 반환하는 것이므로 새로운 노드를 생성하는 것
2. 그래프를 인접리스트로 주어진 상황에서 hashmap을 활용하할 수 있다는 것을 바로 캐치하는 것이 중요 할 것
소스코드