摘要: 题目:Valid Parentheses 题目来源:leetcode 题目描述: Given a string containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string 阅读全文
posted @ 2018-09-07 16:54 jm_epiphany 阅读(1708) 评论(0) 推荐(0) 编辑
摘要: C题目来源:leetcode 题目描述: Roman numerals are represented by seven different symbols: I, V, X, L, C, D and M. For example, two is written as II in Roman num 阅读全文
posted @ 2018-09-05 17:04 jm_epiphany 阅读(367) 评论(0) 推荐(0) 编辑
摘要: arr.slice(begin,end) slice() 方法返回一个从开始到结束(不包括结束)选择的数组的一部分浅拷贝到一个新数组对象。且原始数组不会被修改。 如果该参数为负数, 则它表示在原数组中的倒数第几个元素结束抽取。 slice(-2,-1)表示抽取了原数组中的倒数第二个元素到最后一个元素 阅读全文
posted @ 2018-09-05 16:02 jm_epiphany 阅读(168) 评论(0) 推荐(0) 编辑
摘要: str.substr(start,length) substr() 方法返回一个字符串中从指定位置开始到指定字符数的字符。 start为开始位置,length为所截取字符串的长度 如果 start 为负值,则 substr 把它作为从字符串末尾开始的一个字符索引。如果 start 为负值且 abs( 阅读全文
posted @ 2018-09-05 15:14 jm_epiphany 阅读(419) 评论(0) 推荐(0) 编辑
摘要: 题目描述: Title Case a Sentence 句中单词首字母大写 确保字符串的每个单词首字母都大写,其余部分小写。 题目来源:freecodecamp 注意: 字符串可以通过运算操作改变,但不能通过下标值去修改某个特定字符,唯一的方法是重新赋值。 1 function titleCase( 阅读全文
posted @ 2018-09-05 14:50 jm_epiphany 阅读(814) 评论(0) 推荐(0) 编辑
摘要: 题目描述: 找出最长单词 在句子中找出最长的单词,并返回它的长度。 函数的返回值应该是一个数字 题目来源:freecodecamp 全部代码: @jm_epiphany 阅读全文
posted @ 2018-09-05 14:28 jm_epiphany 阅读(511) 评论(0) 推荐(0) 编辑
摘要: 题目描述:如果一个字符串忽略标点符号、大小写和空格,正着读和反着读一模一样,那么这个字符串就是palindrome(回文)。 题目来源:freecodecamp 重点:除去所有标点符号 1 str=str.replace(/[\ |\~|\`|\!|\@|\#|\$|\%|\^|\&|\*|\(|\ 阅读全文
posted @ 2018-09-05 14:14 jm_epiphany 阅读(658) 评论(0) 推荐(0) 编辑
摘要: 题目来源:leetcode Reverse Integer Given a 32-bit signed integer, reverse digits of an integer. Example 1: Example 2: Example 3: Input: 123 Input: -123 Inp 阅读全文
posted @ 2018-09-04 20:27 jm_epiphany 阅读(762) 评论(0) 推荐(0) 编辑