Skip to content

Commit f027cc1

Browse files
Update generate_parentheses_iterative.py
1 parent 9428fa3 commit f027cc1

File tree

1 file changed

+2
-9
lines changed

1 file changed

+2
-9
lines changed

backtracking/generate_parentheses_iterative.py

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,4 @@
11
"""
2-
>>> generate_parentheses_iterative(1)
3-
['()']
4-
5-
>>> generate_parentheses_iterative(0)
6-
['']
7-
82
Generate all valid combinations of parentheses (Iterative Approach).
93
104
The algorithm works as follows:
@@ -37,13 +31,12 @@ def generate_parentheses_iterative(length: int = 0) -> list:
3731
"""
3832
>>> generate_parentheses_iterative(3)
3933
['()()()', '()(())', '(())()', '(()())', '((()))']
40-
4134
>>> generate_parentheses_iterative(2)
4235
['()()', '(())']
43-
36+
>>> generate_parentheses_iterative(1)
37+
['()']
4438
>>> generate_parentheses_iterative()
4539
['']
46-
4740
"""
4841
result = []
4942
stack = []

0 commit comments

Comments
 (0)