Skip to content

Commit 8ae140b

Browse files
Added solution
1 parent 62e1928 commit 8ae140b

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

find_the_difference.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
class Solution:
2+
def findTheDifference(self, s: str, t: str) -> str:
3+
from collections import Counter
4+
hashed_s, hashed_t = dict(Counter(s)), dict(Counter(t))
5+
found = ""
6+
for char in t:
7+
if char not in hashed_s:
8+
found = char
9+
return found
10+
elif hashed_s[char] != hashed_t[char]:
11+
found = char
12+
return found
13+
return None

0 commit comments

Comments
 (0)