389. Find the Difference

来源:互联网 发布:淘宝衣服一元包邮 编辑:程序博客网 时间:2024/06/11 22:03
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
0 0
原创粉丝点击