Submission Detail

8 / 8 test cases passed.
Status:

Accepted

Runtime: 83 ms
Memory Usage: 13.5 MB
Submitted: 0 minutes ago
loading
Runtime Error Message:
Last executed input:
Input:
Output:
Expected:

Accepted Solutions Runtime Distribution

0
10
20
30
40
50
60
70
80
2
4
6
8
python
You are here!
Your runtime beats 5.09 % of python submissions.
Runtime (ms)
Distribution (%)

0
10
20
30
40
50
60
70
80
5
Zoom area by dragging across this chart

Accepted Solutions Memory Distribution

13450
13200
13250
13300
13350
13400
13500
13550
13600
13650
13700
5
10
15
20
25
30
35
40
python
You are here!
Your memory usage beats 92.77 % of python submissions.
Memory (KB)
Distribution (%)

13450
13200
13250
13300
13350
13400
13500
13550
13600
13650
13700
10
20
30
40
Zoom area by dragging across this chart

Invite friends to challenge Generate Parentheses


Submitted Code: 0 minutes ago

Language: python

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
class Solution(object):
def generateParenthesis(self, n):
"""
:type n: int
:rtype: List[str]
"""
paren = ["()"]
if (n == 1):
return paren
for i in range(2,n+1):
n_paren = []
for p in paren:
ind = 0
perm = ""
while (ind < len(p)-1):
perm = p[0:ind+1] + "()" + p[ind+1:]
if (perm not in n_paren):
n_paren.append(perm)
ind += 1
perm = ""
perm = p + "()"
if (perm not in n_paren):
n_paren.append(perm)
paren = list(n_paren)
return paren
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX