Submission Detail

118 / 118 test cases passed.
Status:

Accepted

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

Accepted Solutions Runtime Distribution

200
400
600
800
1000
1200
1400
1600
1800
2000
1.0
2.0
3.0
4.0
python
You are here!
Your runtime beats 16.61 % of python submissions.
Runtime (ms)
Distribution (%)

200
400
600
800
1000
1200
1400
1600
1800
2000
2
4
Zoom area by dragging across this chart

Accepted Solutions Memory Distribution

16500
17000
17500
18000
18500
19000
19500
20000
20500
21000
2
4
6
8
10
python
Memory (KB)
Distribution (%)

16500
17000
17500
18000
18500
19000
19500
20000
20500
21000
5
10
Zoom area by dragging across this chart

Invite friends to challenge Group Anagrams


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 groupAnagrams(self, strs):
"""
:type strs: List[str]
:rtype: List[List[str]]
"""
words = {}
for i in range(0,len(strs)):
sum = 0
word = {}
for j in range(0,len(strs[i])):
if (strs[i][j] not in word):
word[strs[i][j]] = 1
else:
word[strs[i][j]] += 1
word = list(word.items())
word.sort()
word = tuple(word)
if (word not in words):
words[word] = [strs[i]]
else:
words[word].append(strs[i])
groups = []
for k,v in words.items():
groups.append(v)
return groups
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX