class Solution(object):
def findTheDifference(self, s, t):
"""
:type s: str
:type t: str
:rtype: str
"""
dic ={}
for it in s:
dic[it] = dic.get(it,0)+1
for it in t:
if dic.get(it,0) == 0:
return it
else:
dic[it] -= 1
389. Find the Difference
最新推荐文章于 2024-09-29 07:15:00 发布