国产探花免费观看_亚洲丰满少妇自慰呻吟_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'; } }};
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 深泽县| 临沂市| 衡阳市| 新源县| 天台县| 甘谷县| 固安县| 普安县| 静宁县| 和林格尔县| 鄂托克旗| 封丘县| 阳信县| 右玉县| 上栗县| 利川市| 宜兰市| 华安县| 光泽县| 临安市| 张北县| 花莲县| 深圳市| 德阳市| 深泽县| 安福县| 德化县| 长岭县| 隆子县| 惠水县| 黎川县| 新兴县| 金堂县| 彩票| 连城县| 太仓市| 肥西县| 牙克石市| 昆山市| 霸州市| 铜陵市|