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

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

389. Find the Difference

2019-11-11 01:39:58
字體:
來源:轉載
供稿:網友

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'; } }};
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 连城县| 温州市| 义马市| 若尔盖县| 汝阳县| 山阴县| 武穴市| 肇庆市| 洛宁县| 辽中县| 江门市| 兴山县| 乾安县| 乌鲁木齐市| 壶关县| 开远市| 固镇县| 板桥市| 广东省| 社旗县| 略阳县| 于都县| 洪雅县| 保亭| 渑池县| 高要市| 通城县| 城口县| 陇南市| 彝良县| 吉木乃县| 太和县| 湖北省| 平乐县| 界首市| 盘山县| 钦州市| 靖州| 荥阳市| 福海县| 桐庐县|