Submission Detail

26 / 26 test cases passed.
Status:

Accepted

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

Accepted Solutions Runtime Distribution

0
5
10
15
20
25
30
35
40
45
2
4
6
8
10
python
You are here!
Your runtime beats 70.64 % of python submissions.
Runtime (ms)
Distribution (%)

0
5
10
15
20
25
30
35
40
45
5
10
Zoom area by dragging across this chart

Accepted Solutions Memory Distribution

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

13350
13100
13150
13200
13250
13300
13400
13450
13500
13550
13600
10
20
30
Zoom area by dragging across this chart

Invite friends to challenge Permutations


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
class Solution(object):
def permute(self, nums):
"""
:type nums: List[int]
:rtype: List[List[int]]
"""
nums.sort()
queue = []
perms = []
for n in nums:
queue.append([n])
while (queue != []):
p = queue.pop(0)
if (len(p) == len(nums)):
perms.append(p)
continue
for n in nums:
if (n not in p):
p.append(n)
perm = list(p)
queue.append(perm)
p.remove(n)
return perms
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX