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

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

389. Find the Difference

2019-11-10 22:59:54
字體:
供稿:網(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ā)表
主站蜘蛛池模板: 方山县| 筠连县| 梅州市| 大埔县| 封开县| 夹江县| 永善县| 文成县| 邳州市| 朝阳区| 岳阳市| 长岭县| 宜良县| 昭苏县| 佳木斯市| 绥阳县| 大名县| 临沂市| 来宾市| 乌鲁木齐县| 三台县| 健康| 合水县| 永定县| 丰顺县| 法库县| 嘉鱼县| 涟源市| 缙云县| 张北县| 余江县| 江达县| 健康| 呼伦贝尔市| 盈江县| 隆林| 凉城县| 于都县| 林甸县| 盐池县| 泸溪县|