File tree Expand file tree Collapse file tree
solutions/0133_Clone_Graph Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -9,33 +9,37 @@ Automatically synchronize accepted LeetCode submissions to GitHub.
99``` text
1010████████████░░░░░░░░░░░░░░░░░░
1111
12- Solved: 121 / 300 Problems
12+ Solved: 122 / 300 Problems
1313
1414📊 Statistics
1515Difficulty Solved
1616🟢 Easy 63
17- 🟡 Medium 52
17+ 🟡 Medium 53
1818🔴 Hard 6
19- Total 121
19+ Total 122
2020🔥 Latest Accepted Problem
2121
2222
2323| Field | Value |
2424|------|------|
25- | Problem ID | 200 |
26- | Title | Number Of Islands |
25+ | Problem ID | 133 |
26+ | Title | Clone Graph |
2727| Language | Python3 |
28- | Runtime | 252 ms |
29- | Memory | 21.6 MB |
28+ | Runtime | 49 ms |
29+ | Memory | 19.8 MB |
3030
3131
3232💻 Languages Used
3333
34- - **Python3** : 1
34+ - **Python3** : 5
3535
3636## 📚 Recent Accepted Problems
3737
38- - 200 Number Of Islands
38+ - 133 Clone Graph
39+ - 1 Two Sum
40+ - 295 Find Median From Data Stream
41+ - 1 Two Sum
42+ - 295 Find Median From Data Stream
3943
4044
4145---
7781GitHub
7882⏰ Last Sync
7983
80- 2026-07-03 09:17:32
84+ 2026-07-03 14:03:05
Original file line number Diff line number Diff line change 1+ {
2+ "submission_id" : " 2054682645" ,
3+ "question_id" : " 133" ,
4+ "title_slug" : " clone-graph" ,
5+ "language" : " python3" ,
6+ "language_verbose" : " Python3" ,
7+ "runtime" : " 49 ms" ,
8+ "memory" : " 19.8 MB" ,
9+ "status_code" : 10 ,
10+ "timestamp" : 1783084243
11+ }
Original file line number Diff line number Diff line change 1+ """
2+ # Definition for a Node.
3+ class Node:
4+ def __init__(self, val = 0, neighbors = None):
5+ self.val = val
6+ self.neighbors = neighbors if neighbors is not None else []
7+ """
8+
9+ from typing import Optional
10+ class Solution :
11+ def cloneGraph (self , node : Optional ['Node' ]) -> Optional ['Node' ]:
12+ if not node :
13+ return None
14+ visited = {}
15+
16+ def dfs (node ):
17+ if node in visited :
18+ return visited [node ]
19+ copy = Node (node .val )
20+
21+ visited [node ]= copy
22+
23+ for neighbor in node .neighbors :
24+ copy .neighbors .append (dfs (neighbor ))
25+ return copy
26+ return dfs (node )
Original file line number Diff line number Diff line change 11{
2- "total" : 0 ,
3- "easy" : 0 ,
4- "medium" : 0 ,
5- "hard" : 0 ,
2+ "total" : 122 ,
3+ "easy" : 63 ,
4+ "medium" : 53 ,
5+ "hard" : 6 ,
66 "languages" : {
7- "Python3" : 4
7+ "Python3" : 5
88 },
99 "recent_problems" : [
10+ {
11+ "id" : " 133" ,
12+ "title" : " Clone Graph"
13+ },
1014 {
1115 "id" : " 1" ,
1216 "title" : " Two Sum"
2529 }
2630 ],
2731 "last_problem" : {
28- "id" : " 1 " ,
29- "title" : " Two Sum " ,
32+ "id" : " 133 " ,
33+ "title" : " Clone Graph " ,
3034 "language" : " Python3" ,
31- "runtime" : " 45 ms" ,
32- "memory" : " 17 MB"
35+ "runtime" : " 49 ms" ,
36+ "memory" : " 19.8 MB"
3337 },
34- "last_sync" : " 2026-07-02 12:18:27 "
38+ "last_sync" : " 2026-07-03 14:03:05 "
3539}
You can’t perform that action at this time.
0 commit comments