class Solution:
def findTheDifference(self, s, t):
"""
:type s: str
:type t: str
:rtype: str
"""
dp=[0]*26
for i in range(len(s)):
dp[ord(s[i])-97]-=1
dp[ord(t[i])-97]+=1
for j in range(len(s),len(t)):
dp[ord(t[j])-97]+=1
return chr(dp.index(1)+97)
python leetcode 389. Find the Difference
最新推荐文章于 2024-08-15 05:02:54 发布