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

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

389. Find the Difference

2019-11-11 00:06:43
字體:
來源:轉載
供稿:網友

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'; } }};
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 都兰县| 临汾市| 苍溪县| 固镇县| 新和县| 广水市| 四平市| 宣威市| 扎兰屯市| 元氏县| 溧水县| 汉阴县| 浮梁县| 陆川县| 大同市| 保靖县| 炎陵县| 荔浦县| 巩义市| 镶黄旗| 梨树县| 城口县| 长宁区| 巴中市| 津南区| 桑日县| 光山县| 遵义县| 隆林| 贵溪市| 武威市| 黄浦区| 三台县| 昌乐县| 昭通市| 龙山县| 四川省| 汤原县| 鹤岗市| 仲巴县| 墨玉县|