题目描述有m个盒子,第i个盒子的长尾hi,宽为wi。如果两个盒子i,j满足hi#include#includeusing
namespace std;const int maxn=20001;struct node{ int x,y;}box[maxn];int
a[maxn];bool cm...
分类:
其他好文 时间:
2014-05-20 02:11:24
阅读次数:
251
问题:寻找最长公共前缀思路:就是逐一检查每个string中的每一位,碰到不相等的时候,结束;每个string中这一位都相等,加入到common
prefix中~public String longestCommonPrefix(String[] strs) { int ...
分类:
其他好文 时间:
2014-05-19 21:12:05
阅读次数:
292
function(name) { var
query=location.search.substring(1); var pairs=query.split("&"); for(var
i=0;i<pairs.length;i++) ...
分类:
其他好文 时间:
2014-05-19 10:43:27
阅读次数:
266
Given a stringS, find the longest palindromic
substring inS. You may assume that the maximum length ofSis 1000, and there
exists one unique longest pa...
分类:
其他好文 时间:
2014-05-18 19:39:55
阅读次数:
355
Yougth的最大化
时间限制:1000 ms | 内存限制:65535 KB
难度:4
描述
Yougth现在有n个物品的重量和价值分别是Wi和Vi,你能帮他从中选出k个物品使得单位重量的价值最大吗?
输入有多组测试数据
每组测试数据第一行有两个数n和k,接下来一行有n个数Wi和Vi。
(1
输出输出使得单位价值的最大值。(保留两位小数)
样...
分类:
其他好文 时间:
2014-05-18 14:37:25
阅读次数:
229
【题目】
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 any intervening characters.
For example, given:
S:...
分类:
其他好文 时间:
2014-05-18 08:31:48
阅读次数:
228
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 ...
分类:
其他好文 时间:
2014-05-18 01:52:45
阅读次数:
317
【题目】
原文:
1.8 Assume you have a method isSubstring which checks if one word is a substring of another. Given two strings, s1 and s2, write code to check if s2 is a rotation of s1 using only one...
分类:
其他好文 时间:
2014-05-16 01:50:08
阅读次数:
311
Given a string, find the length of the longest
substring without repeating characters. For example, the longest substring
without repeating letters fo...
分类:
其他好文 时间:
2014-05-15 17:50:38
阅读次数:
298
字符串连接误用 错误的写法:String s = ""; for (Person p :
persons) { s += ", " + p.getName(); } s = s.substring(2); //remove first comma
正确的写法:StringBuilde...
分类:
编程语言 时间:
2014-05-15 17:38:49
阅读次数:
493