力扣网题号:389找不同python 实现
题目描述:
给定两个字符串s和t,它们只包含小写字母。
字符串t由字符串s随机重排,然后在随机位置添加一个字母。
请找出在t中被添加的字母。
示例:
输入:
s = "abcd"
t = "abcde"
输出:
e
解释:
'e' 是那个被添加的字母。
一、题解
使用collections中Counter模块
from collections import Counter
def finddiff(s,t):
word = list((Counter(t...
原创
2020-06-12 10:41:46 ·
208 阅读 ·
0 评论