Missing letters
function fearNotLetter(str) {
//return str;
var arr = str.split('');
var temp = [];
var start = str.charCodeAt(0);
var end = str.charAt(str.length - 1).charCodeAt(0);
for(var i = start; i < end + 1; i++){
var item = String.fromCharCode(i);
if(arr[0] !== item){
temp.push(item);
}else{
arr.shift();
}
}
if(temp.length === 0){
return undefined;
}else{
return temp.join('');
}
}
fearNotLetter("abce");
Missing letters的更多相关文章
- FCC-学习笔记 Missing letters
FCC-学习笔记 Missing letters 1>最近在学习和练习FCC的题目.这个真的比较的好,推荐给大家. 2>中文版的地址:https://www.freecodecamp.c ...
- freeCodeCamp:Missing letters
从传递进来的字母序列中找到缺失的字母并返回它. 如果所有字母都在序列中,返回 undefined. function fearNotLetter(str) { var arr = str.split( ...
- Missing letters-freecodecamp算法题目
Missing letters 1.要求 从传递进来的字母序列中找到缺失的字母并返回它. 如果所有字母都在序列中,返回 undefined. 2.思路 设定缺失变量miss 在for循环遍历字符串的各 ...
- 2076 Problem F Quick Brown Fox
题目描述 A pangram is a phrase that includes at least one occurrence of each of the 26 letters, ‘a’. . . ...
- FreeCodeCamp 中级算法(个人向)
freecodecamp 中级算法地址戳这里 Sum All Numbers in a Range 我们会传递给你一个包含两个数字的数组.返回这两个数字和它们之间所有数字的和. function su ...
- Codeforces Round #372 (Div. 2) B
Description ZS the Coder loves to read the dictionary. He thinks that a word is nice if there exists ...
- Codeforces Round #372 (Div. 2) A B C 水 暴力/模拟 构造
A. Crazy Computer time limit per test 2 seconds memory limit per test 256 megabytes input standard i ...
- Codeforces 716B Complete the Word【模拟】 (Codeforces Round #372 (Div. 2))
B. Complete the Word time limit per test 2 seconds memory limit per test 256 megabytes input standar ...
- Complete the Word CodeForces - 716B
ZS the Coder loves to read the dictionary. He thinks that a word is nice if there exists asubstring ...
随机推荐
- GridView与CheckBox完美结合
版本一:单纯地实现全选和全取消,http://www.cnblogs.com/insus/archive/2009/03/14/1411613.html 版本二:修改选中行的背景颜色,http://w ...
- JSTL中的scope属性
前两天接到老大一个任务:要验证一下<c:import>能否动态地引入不同的文件.当时很兴奋,要知道在对日外包里面,这个也得算技术活了.呵呵! 说干就干,写了两个jsp文件:m.jsp t ...
- 配置SQL Server 2005 远程连接(转)
方法如下: 一.为 SQL Server 2005 启用远程连接1. 单击"开始",依次选择"程序"."Microsoft SQL Server 2 ...
- 全面了解 Linux 服务器 - 1. 查看 Linux 服务器的 CPU 详细情况
1. 查看 Linux 服务器的 CPU 详细情况 判断依据: 具有相同的 core id 的 CPU 是同意个 core 超线程. 具有相同的 physical id 的 CPU 是同一个 CPU ...
- EF 示例
EF有三种数据库访问方式,这里只介绍Code First. 1.DB First,类似Linq to sql中拖拽一个DB到方案中 2.Model First,没试过,不能自动生成数据库只能生成表 3 ...
- [IIS]IIS扫盲(二)
iis - IIS之Web服务器建立 第一篇 IIS之Web服务器 一.建立第一个Web站点 比如本机的IP地址为192.168.0.1,自己的网页放在D:\Wy目录下,网页的首页文件名为Inde ...
- 使用 jQuery Mobile 与 HTML5 开发 Web App —— HTML5 离线缓存
本文要介绍的,是 HTML5 离线网络应用程序的特性,离线网络应用程序在 W3C 中的实际名称是 "Offline Web applications" ,也称离线缓存.当用户打开浏 ...
- Chap2: question: 1 - 10
1. 赋值运算符函数(或应说复制拷贝函数问题) class A { private: int value; public: A(int n) : value(n) {} A(A O) { value ...
- 2.6内核LOGO制作方法
http://blog.csdn.net/tommy_wxie/article/details/8594286
- 黑盒测试与白盒测试(Black box Testing)
黑盒测试和白盒测试的优缺点 类别 优点 缺点 黑盒测试 不需要了解软件代码 从用户角度出发 无法保证代码内各个路径被覆盖到 白盒测试 强制测试开发工程师关注代码的具体实现 揭露隐藏在代码中的Bug 是 ...