https://leetcode.com/problems/longest-palindromic-substring/题目:Given a stringS, find the longest palindromic substring inS. You may assume that the ma...
分类:
其他好文 时间:
2015-07-25 22:46:20
阅读次数:
200
1.求字符串中连续出现最多的字串pair substring(const string& str){ int i, j, k, len = str.length(), count, maxcount = 1; string substr; vector substrs; //...
分类:
其他好文 时间:
2015-07-25 19:48:41
阅读次数:
101
今天有人在群里问这两个的区别,借这个机会在这罗列下
substring(from,to)
开始和结束的位置,从零开始的索引
参数 描述
from 必需。一个非负的整数,规定要提取的子串的第一个字符在 stringObject 中的位置。
to 可选。一个非负的整数,比要提取的子串的最后一个字符在 stringObject 中的位置多 1。如果省略该参数,...
分类:
Web程序 时间:
2015-07-25 16:51:45
阅读次数:
165
NSString *allString=@"你家在哪里,需要我送你么"; NSString *subString=@"在哪里"; UILabel *stringLabel=[[UILabel alloc]init]; stringLabel.frame=CGRectMake(0, 100, 3...
分类:
其他好文 时间:
2015-07-25 16:40:39
阅读次数:
169
10285 Longest Run on a Snowboard
Michael likes snowboarding. That’s not very surprising, since snowboarding is really great. The bad
thing is that in order to gain speed, the area must slide downward...
分类:
其他好文 时间:
2015-07-25 13:49:45
阅读次数:
269
题意:
给出一个有权树,求树上两点路径的最大异或和;
n
题解:
考虑异或的性质,如果任选一点为根,处理出所有点的异或深度;
那么将两点的深度异或起来,LCA到根的路径就异或了两次相当于没有;
所以异或距离就是两点异或深度的异或和,问题就转化成了从n个数中选两个数使异或和最大;
这个经典问题就可以把数字按位存进01trie树,从高位到低位贪心求解;
复杂度O(31n);
...
分类:
其他好文 时间:
2015-07-25 09:34:21
阅读次数:
109
Given an unsorted array of integers, find the length of the longest consecutive elements sequence.For example,Given[100, 4, 200, 1, 3, 2],The longest ...
分类:
其他好文 时间:
2015-07-24 22:14:56
阅读次数:
115
Write a function to find the longest common prefix string amongst an array of strings.class Solution {public: string longestCommonPrefix(vector& st...
分类:
其他好文 时间:
2015-07-24 06:55:48
阅读次数:
143
mysql处理字符串的两个绝招:substring_index,concat 最近老是碰到要处理数据库中字符串的处理,发现用来用去也就是这两个函数: 1、substring_index(str,delim,count) str:要处理的字符串 delim:分隔符 count:计数 ...
分类:
数据库 时间:
2015-07-23 17:17:39
阅读次数:
138
Encoding encoding = Encoding.GetEncoding("gb2312"); 与byte[] ping = Encoding.UTF8.GetBytes(inputString);区别public static string SubString(string inputSt...
分类:
其他好文 时间:
2015-07-23 17:09:37
阅读次数:
117