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 ...
随机推荐
- c#操作文件夹得读写权限
对文件夹设置为Everyone的权限,首先需要先添加引用 using System.Security.AccessControl; 采用下面的方法对文件夹设置Everyone权限 /// < ...
- Xcode解决代码高亮、语法提示、错误警告等功能失效的解决方法
在编写xcode的项目的时候出现过代码不高亮的症状,而且所有的warning都不再提示,include的内容也显示symbol not found,非常奇怪,解决方案如下: 方法一: 1.把.pch里 ...
- 基于Spring框架的Shiro配置
一.在web.xml中添加shiro过滤器 <!-- Shiro filter--> <filter> <filter-name>shiroFilter</ ...
- <mvc:annotation-driven/>与<mvc:default-servlet-handler/>之间的一个问题
<mvc:annotation-driven/>与<mvc:default-servlet-handler/>之间的一个问题 在做项目的时候,我希望静态资源由WEB服务器默认的 ...
- hpp头文件与h头文件的区别
hpp,其实质就是将.cpp的实现代码混入.h头文件当中,定义与实现都包含在同一文件,则该类的调用者只需要include该hpp文件即可,无需再将cpp加入到project中进行编译.而实现代码将直接 ...
- ADF_Data Binding系列1_使用Bean Data Control
2015-02-16 Created By BaoXinjian
- HTC Vive开发笔记之手柄震动
手柄震动的代码SteamVR_Controller脚本的最上面的注释里面就有说明,其实也很简单 // Example usage: //这个栗子是左手柄震动 右手震动只需把Leftmost换成Righ ...
- MyBatis Sql语句中的转义字符
1.在xml的sql语句中,不能直接用大于号.小于号要用转义字符 如果用小于号会报错误如下: org.apache.ibatis.builder.BuilderException: Error cre ...
- FPGA边缘检测
沿检测技术在项目应用中, 非常低广泛. 如要有效捕获信号跳变沿, 边沿 检测技术的应用是必不可少的.大致如下: (1) 将时钟边沿使能转换为边沿检测使能,使时钟同步化. (2) 捕获信号的突变( UA ...
- ORA-27092: size of file exceeds file size limit of the process
停数据库时遇到下述问题: $ ./addbctl.sh stop You are running addbctl.sh version 120.1 Shutting down database UAT ...