标签:etc 字符串 def col 一个 The pre nbsp obj
多了一个字母,就两个字符串一减就得到多的那个.
但是字符串不能直接相减,所以就转成数字再减,最后再转回来.
class Solution(object): def findTheDifference(self, s, t): return chr(sum(map(ord,t))-sum(map(ord,s)))
Leetcode 389. Find the Difference
标签:etc 字符串 def col 一个 The pre nbsp obj
原文地址:https://www.cnblogs.com/zywscq/p/10659522.html