LeetCode Problems

Clone Graph (Medium): Oof, this is actually a confusing question. In my original implementation, I was using hashmap(unordered_map) but with type <int, int>, but it actually makes the question easier with type <Node*, Node*> Another thing that I was struggling to understand is to clone and maintain a graph structure for the new graph. In c++, we kinda need to use the keyword new to clone it. To maintain a graph structure, I need to make sure to update the adjacency list properly....

January 19, 2024 · 12 min · Jiayu Lin