15 lines
423 B
Python
15 lines
423 B
Python
# 389. Find the Difference
|
|
# https://leetcode.com/problems/find-the-difference
|
|
#
|
|
# You are given two strings s and t.
|
|
#
|
|
# String t is generated by random shuffling string s and then add one more letter at a random position.
|
|
#
|
|
# Return the letter that was added to t.
|
|
|
|
def findTheDifference(s: str, t: str) -> str:
|
|
for i in range(len(t)):
|
|
if s.count(t[i]) != t.count(t[i]):
|
|
return t[i]
|
|
return ""
|