Skip to content

Commit d771089

Browse files
authored
Create e2451.py
1 parent fb5743c commit d771089

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

my-submissions/e2451.py

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
class Solution:
2+
def oddString(self, words: List[str]) -> str:
3+
firstTup = None
4+
foundTwice = False
5+
otherWord = None
6+
7+
for i, word in enumerate(words) :
8+
currTup = tuple(ord(word[i]) - ord(word[i - 1])
9+
for i in range(1, len(word)))
10+
11+
if not firstTup :
12+
firstTup = currTup
13+
continue
14+
15+
if firstTup == currTup :
16+
if otherWord :
17+
return otherWord
18+
foundTwice = True
19+
continue
20+
21+
if not otherWord :
22+
if foundTwice :
23+
return word
24+
otherWord = word
25+
continue
26+
27+
return words[0]

0 commit comments

Comments
 (0)