/*-----------------------------------------------------有n个物体,第i个物体的重量是wi,价值为vi,选若干个物体,使得在总重量不超过c的情况下让总价值尽量高。这里每个物体都可以只取走一部分,价值和重量按比例计算。输入:第一行输入两个整数表示n...
分类:
其他好文 时间:
2014-07-29 10:57:46
阅读次数:
400
1 public class Solution { 2 public static int lengthOfLongestSubstring(String s) { 3 4 char[] arr = s.toCharArray(); 5 int pre = 0; 6 ...
/*-----------------------------------------------------给出n个物体,第i个物体的重量为wi。选择尽量多的物体,使得总重量不超过C。 输入:n和C以及n个整数表示的wi。 输出:按照输入物体的顺序输出n个用空格分隔的Y或N。Y表示该物体被选中,N...
分类:
其他好文 时间:
2014-07-28 23:42:14
阅读次数:
265
Given a string s, partition s such that every substring of the partition is a palindrome.Return all possible palindrome partitioning of s.For example,...
分类:
其他好文 时间:
2014-07-28 19:17:14
阅读次数:
245
Similar with "Longest Consecutive Sequence". Another usage to hashset.Take care of corner cases!class Solution {public: int firstMissingPositive(in...
分类:
其他好文 时间:
2014-07-28 15:16:43
阅读次数:
206
题目:Given a string S and a string T, find the minimum window in S which will contain all the characters in T in complexity O(n).For example,S = "ADOBE....
分类:
编程语言 时间:
2014-07-28 14:42:23
阅读次数:
264
题目: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 conca....
分类:
编程语言 时间:
2014-07-28 14:39:03
阅读次数:
1117
题目:Given a string, find the length of the longest substring without repeating characters. For example, the longest substring without repeating letter....
分类:
编程语言 时间:
2014-07-28 11:34:30
阅读次数:
265
题目:Write a function to find the longest common prefix string amongst an array of strings.题解:解题思路是,先对整个String数组预处理一下,求一个最小长度(最长前缀肯定不能大于最小长度)。然后以第0个字符串....
分类:
编程语言 时间:
2014-07-28 11:33:30
阅读次数:
241
周末女朋友不在家,打算做几题LeetCode的题目练练手,Pick One,随机抽中Palindrome Partitioning,题目如下: Given a strings, partitionssuch that every substring of the partition is a ...
分类:
其他好文 时间:
2014-07-28 11:32:20
阅读次数:
417