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

首頁 > 學(xué)院 > 開發(fā)設(shè)計(jì) > 正文

389. Find the Difference

2019-11-11 00:14:28
字體:
供稿:網(wǎng)友

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'; } }};
發(fā)表評(píng)論 共有條評(píng)論
用戶名: 密碼:
驗(yàn)證碼: 匿名發(fā)表
主站蜘蛛池模板: 左贡县| 军事| 赞皇县| 广饶县| 兴化市| 建宁县| 嫩江县| 丹凤县| 寿宁县| 墨竹工卡县| 荥经县| 东宁县| 汶上县| 东莞市| 麻栗坡县| 富川| 白沙| 南漳县| 永福县| 定南县| 通辽市| 丽江市| 滁州市| 八宿县| 康保县| 德兴市| 怀集县| 莱芜市| 永顺县| 保山市| 修文县| 神农架林区| 丹阳市| 溧水县| 南川市| 黄梅县| 阿克| 开阳县| 叶城县| 石狮市| 德阳市|