Skip to content

Commit e0a43d0

Browse files
authored
Update redundant-connection.py
1 parent 1af79cb commit e0a43d0

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

Python/redundant-connection.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@
2626
# / \\
2727
# 2 3
2828
# Note:
29-
# The size of the input 2D-array will be between 1 and 1000.
30-
# Every integer represented in the 2D-array will be between 1 and 2000.
29+
# The size of the input 2D-array will be between 3 and 1000.
30+
# Every integer represented in the 2D-array will be between 1 and N, where N is the size of the input array.
3131

3232
class UnionFind(object):
3333
def __init__(self, n):
@@ -54,7 +54,7 @@ def findRedundantConnection(self, edges):
5454
:type edges: List[List[int]]
5555
:rtype: List[int]
5656
"""
57-
union_find = UnionFind(2000)
57+
union_find = UnionFind(len(edges)+1)
5858
for edge in edges:
5959
if not union_find.union_set(*edge):
6060
return edge

0 commit comments

Comments
 (0)