算法系列(8)LeetCode389
来源:互联网 发布:网络电话会议 编辑:程序博客网 时间:2024/06/16 12:19
389.
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.
Input:s = "abcd"t = "abcde"Output:eExplanation:'e' is the letter that was added.
/** * @param {string} s * @param {string} t * @return {character} */var findTheDifference = function(s, t) { //var = new Set; var array1=s.split("").sort(); var array2 = t.split("").sort(); for(var i = 0; i<array2.length; i++){ if(array1[i]!==array2[i]){ //console.log(array2[i]); return array2[i]; } }};
阅读全文
0 0
- 算法系列(8)LeetCode389
- leetcode389
- LeetCode389. Find the Difference
- leetcode389: Find the Difference,
- Leetcode389. Find the Difference
- leetcode389. Find the Difference
- leetcode389. Find the Difference
- 算法系列8《Base64》
- LeetCode389. Find the Difference简单
- leetcode389 Find the Difference java
- python--leetcode389. Find the Difference
- leetcode389[easy]---Find the Difference
- (积累系列—算法)冒泡算法
- Hash算法系列-具体算法(HashedWheelTimer)
- 算法系列(1)排序算法
- USACO算法系列(小结)
- 推荐算法系列(一)
- 算法系列(一)基本概念
- RNN 神经网络数学推导
- 多目标遗传算法NSGA-II在工业机器人关节空间轨迹优化上的应用
- 最全的MySQL大表优化方案
- 使用表单在springMVC的后台上传文件时遇到500错误:The current request is not a multipart request
- java+selenium自动化参考
- 算法系列(8)LeetCode389
- 正则表达式
- NYACM_005
- MVN编译Flume1.7源码时出现下载ua-parses-1.3.0 jar包失败
- ubuntu三行命令安装chrome浏览器
- 大数据处理平台Hadoop之安装(基于ubuntu的Hadoop2.9.0,2.X.X同适用)
- POJ-3140-Contestants Division
- 网络众包平台中期总结
- 分库分表的产生背景