我们经常使用subString方法来对String对象进行分割处理,同时我们也可以使用subList、subMap、subSet来对List、Map、Set进行分割处理,但是这个分割存在某些瑕疵。一、subList返回仅仅只是一个视图 首先我们先看如下实例:public static void main(String[] args) {
List list1 = new...
分类:
编程语言 时间:
2015-03-06 19:07:22
阅读次数:
185
1.题目描述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.2.解决方案1class Solution {
public:...
分类:
其他好文 时间:
2015-03-06 11:22:23
阅读次数:
126
做了一个跑马灯效果,body内是一个returnfalse的小练习。算是最最基础的入门了。祝大家节日快乐!代码如下: 祝大家元宵节快乐! 下面说一下substr()与substring()的小区别。以“问询结果”四字为例。substr(1,3)意为从第一位往后取...
分类:
其他好文 时间:
2015-03-06 01:00:22
阅读次数:
179
1.Length --取字符串长度string x = Console.ReadLine(); int i = x.Length; Console.WriteLine(i);执行结果: 2.Substring(从哪一位开始,截取几位) --截取字符串,从第六位往后截取3位,包括空格在内st...
分类:
其他好文 时间:
2015-03-05 18:43:40
阅读次数:
133
Longest Substring Without Repeating CharactersGiven a string, find the length of the longest substring without repeating characters. For example, the ...
分类:
其他好文 时间:
2015-03-05 16:15:49
阅读次数:
104
var s="http://www.baidu.com";var i= s.lastIndexOf("."); //16var unit= s.substring(i); //.comvar url= s.substring(0,i); //http://www.baidu
分类:
Web程序 时间:
2015-03-04 20:58:32
阅读次数:
119
Write a function to find the longest common prefix string amongst an array of strings.
这个题目非常简单,只要弄清楚题意就可以非常快地解决,我的C++代码实现如下: string longestCommonPrefix(vector &strs) {
if (strs.empt...
分类:
其他好文 时间:
2015-03-04 19:13:18
阅读次数:
127
HDU 1403 Longest Common Substring(后缀数组啊 求最长公共子串 模板题)...
分类:
编程语言 时间:
2015-03-04 19:08:31
阅读次数:
161
代码: 1 #include 2 3 using namespace std; 4 5 int lengthOfLongestSubString(string s) 6 { 7 if (s.length() == 0) 8 return 0; 9 int max ...
分类:
其他好文 时间:
2015-03-04 18:52:52
阅读次数:
104
DP类题目找到子问题(状态),然后找到转移方程,就OK#dp#likes matrixchain#according to two point's distance to recurrenceclass Solution: # @return a string def longest...
分类:
其他好文 时间:
2015-03-04 18:51:45
阅读次数:
122