国产探花免费观看_亚洲丰满少妇自慰呻吟_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'; } }};
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 徐水县| 都匀市| 安吉县| 尤溪县| 南安市| 确山县| 楚雄市| 周口市| 定兴县| 田林县| 白河县| 兴化市| 扶沟县| 乐至县| 沙雅县| 侯马市| 东乡县| 柘城县| 珠海市| 安国市| 大姚县| 葫芦岛市| 沾益县| 兴安县| 福鼎市| 辽宁省| 紫云| 商丘市| 壤塘县| 德州市| 龙井市| 河间市| 马山县| 陆川县| 中江县| 石柱| 凤凰县| 郯城县| 大竹县| 新乡县| 襄垣县|