首页 > 其他 > 详细

Leetcode 389. Find the Difference

时间:2019-04-05 19:34:51      阅读:132      评论:0      收藏:0      [点我收藏+]

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

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

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

 

Leetcode 389. Find the Difference

原文:https://www.cnblogs.com/zywscq/p/10659522.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!