Skip to content

Commit 2740ffb

Browse files
committed
README
1 parent a6f8f56 commit 2740ffb

File tree

2 files changed

+12
-9
lines changed

2 files changed

+12
-9
lines changed

README.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,7 @@
11
# leetcode
2-
My Leetcode Solutions
2+
3+
![image](https://user-images.githubusercontent.com/17960677/163023814-113c3f1c-fa8e-47d7-a747-27b48fb25496.png)
4+
5+
> My Leetcode Solutions
6+
7+
This is a dump of all my accepted leetcode solutions, almost all solutions are written in Python, this is autogenerated using this tool, https://github.com/theabbie/leetcode_dump

clone-graph.py

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,14 @@ def cloneGraph(self, node: 'Node') -> 'Node':
1111
if not node:
1212
return node
1313
nodemap = {}
14-
nodemap[node] = Node(val = node.val)
14+
nodemap[node.val] = Node(val = node.val)
1515
paths = [node]
1616
while len(paths) > 0:
1717
curr = paths.pop()
18-
currcopy = nodemap[curr]
18+
currcopy = nodemap[curr.val]
1919
for nbr in curr.neighbors:
20-
if nbr in nodemap:
21-
currcopy.neighbors.append(nodemap[nbr])
22-
else:
20+
if nbr.val not in nodemap:
2321
paths.append(nbr)
24-
nodemap[nbr] = Node(val = nbr.val)
25-
currcopy.neighbors.append(nodemap[nbr])
26-
return nodemap[node]
22+
nodemap[nbr.val] = Node(val = nbr.val)
23+
currcopy.neighbors.append(nodemap[nbr.val])
24+
return nodemap[node.val]

0 commit comments

Comments
 (0)