国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 學院 > 開發設計 > 正文

389. Find the Difference

2019-11-10 23:09:25
字體:
來源:轉載
供稿:網友

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:eExplanation:'e' is the letter that was added.class Solution {public: char findTheDifference(string s, string t) { int table1[26] = {0}; int table2[26] = {0}; for(int i = 0; i < s.length(); ++i) table1[s[i] - 'a']++; for(int i = 0; i < t.length(); ++i) table2[t[i] - 'a']++; for(int i = 0; i < 26; ++i){ if(table1[i] != table2[i]) return i + 'a'; } }};
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 南部县| 深州市| 湖北省| 五莲县| 马龙县| 湖南省| 资源县| 闻喜县| 漯河市| 平乡县| 阿克苏市| 永兴县| 周口市| 长葛市| 明溪县| 繁昌县| 化德县| 正蓝旗| 肇源县| 延川县| 嘉善县| 达州市| 宜兴市| 海南省| 乌兰县| 金平| 浪卡子县| 焦作市| 盐津县| 贡嘎县| 禄劝| 商南县| 双桥区| 南雄市| 黑龙江省| 无棣县| 井研县| 大关县| 永登县| 灵山县| 新余市|