最近整前台总多多少少遇到一些字符串截取的小问题,忍不住仔细看了下。接下来总结一下javascript中字符串截取方法的一些应用经验和区别。看了其他博主也有写到,各有风格况且只是个人随记,自己体会的才最深刻。 一些看似简单深究又大有文章的东西弄懂了你才知道自己所学甚浅,部分内容是w3cSchool原....
分类:
编程语言 时间:
2015-05-18 16:09:24
阅读次数:
156
题意:
给你一个字符串,求该字符串的最长回文子序列长度。
解法:
以前做过连续最长回文子串的长度就是通过构造奇数偶数长度的来做,而本题是不连续。
注意到回文字符串的特点是从左边向右边看和从右边向左边看是一样的效果,那么就可以把目标字符串s导致后产生一个t,子串中如果t和s相同那么这个子串就是回文子串,那么就转化为这两个子串求LCS(longest common subsequent)的问题了。
我的...
分类:
其他好文 时间:
2015-05-17 13:46:04
阅读次数:
123
题目:Given a binary tree, find its maximum depth.The maximum depth is the number of nodes along the longest path from the root node down to the farthest...
分类:
其他好文 时间:
2015-05-17 00:40:24
阅读次数:
126
Maximum Depth of Binary Tree
Given a binary tree, find its maximum depth.
The maximum depth is the number of nodes along the longest path from the root node down to the farthest leaf node....
分类:
其他好文 时间:
2015-05-16 20:38:48
阅读次数:
152
https://leetcode.com/problems/longest-valid-parentheses/Longest Valid ParenthesesGiven a string containing just the characters'('and')', find the leng...
分类:
编程语言 时间:
2015-05-16 18:21:36
阅读次数:
289
题目描述:Find a longest common subsequence of two strings.输入:First and second line of each input casecontain two strings of lowercase character a…z. There...
分类:
其他好文 时间:
2015-05-16 18:13:58
阅读次数:
99
题目描述:You are given a string, s, and a list of words, words, that are all of the same length. Find all starting indices of substring(s) in s that is a ...
分类:
编程语言 时间:
2015-05-16 17:44:55
阅读次数:
141
You are given a string, s, and a list of words, words, that are all of the same length. Find all starting indices of substring(s) in s that is a concatenation
of each word in wordsexactly once and w...
分类:
其他好文 时间:
2015-05-16 16:32:19
阅读次数:
89
题意:
There is a array contain N(1
Every query will be:
1 x : ask longest substring which every number no less than x
2 y x : change the A[y] to x. there are at most change 10 times.
For each ask...
分类:
其他好文 时间:
2015-05-16 14:52:28
阅读次数:
121
Problem Description
There is a sequence of integers. Your task is to find the longest subsequence that satisfies the following condition: the difference between the maximum element and the minimum ...
分类:
其他好文 时间:
2015-05-16 11:57:35
阅读次数:
127