Skip to content

Commit 42c39cd

Browse files
committed
Runtime: 44 ms (Top 40.74%) | Memory: 17.40 MB (Top 5.82%)
1 parent 1bfbf75 commit 42c39cd

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// Runtime: 44 ms (Top 40.74%) | Memory: 17.40 MB (Top 5.82%)
2+
3+
class Solution:
4+
def oddString(self, words: List[str]) -> str:
5+
hashmap = defaultdict(list)
6+
for w in words:
7+
difference = []
8+
for i in range(1,len(w)):
9+
difference.append(ord(w[i])-ord(w[i-1]))
10+
hashmap[tuple(difference)].append(w)
11+
for k,a in hashmap.items():
12+
if len(a) == 1:
13+
return a[0]

0 commit comments

Comments
 (0)