Leetcode 389. Find the Difference

多了一个字母,就两个字符串一减就得到多的那个.

但是字符串不能直接相减,所以就转成数字再减,最后再转回来.

class Solution(object):
    def findTheDifference(self, s, t):
        return chr(sum(map(ord,t))-sum(map(ord,s)))

 

posted @ 2019-04-05 19:11  周洋  阅读(108)  评论(0编辑  收藏  举报