Given two strings s and t which consist of only lowercase letters.
String t is generated by random shuffling string s and then add one more letter at a random position.
Find the letter that was added in t.
Example:
Input:
s = "abcd"
t = "abcde"
Output:
e
Explanation:
‘e’ is the letter that was added.
用数组记录字符的老办法。
public char findTheDifference(String s, String t) {
int[] count = new int[

这道题目是关于LeetCode的389题,目标是找出在经过随机打乱并添加一个字母后的字符串t中,新增的那个字母。通过比较两个字符串的字符计数差异来找到答案。
订阅专栏 解锁全文
382

被折叠的 条评论
为什么被折叠?



