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

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

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

 

相关文章:

  • 2021-07-11
  • 2022-02-06
  • 2022-01-25
  • 2021-10-20
  • 2022-12-23
  • 2021-11-18
猜你喜欢
  • 2021-06-06
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-10-15
  • 2022-02-12
  • 2022-12-23
相关资源
相似解决方案