Clone Graph (LC #133) is one of Meta's most asked graph problems. Given a node in a connected undirected graph, return a deep copy. Use a hash map from original node to its clone. BFS or DFS through the graph. For each node, create its clone if not in the map. For each neighbor, recursively clone it and add to the current clone's neighbor list. The map prevents infinite loops and duplicate nodes. This runs in time and space. Meta asks variants with weighted edges or directed graphs.
##### ###### ##### ### # # ### # # ###### ## ## ## ## ## ## ## # # # # # ## ##### #### ##### # # # # # # # #### ## # ## ## ## ## # # # # # ## ## # ###### ## ### # ### # ######
$ curl repovive.com/roadmaps/meta-interview-prep/graphs/clone-graph
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░███████████████████████████████████████████████████████████████████