码迷,mamicode.com
首页 >  
搜索关键字:longest substring wi    ( 8067个结果
贪心算法练习题:部分背包问题
/*-----------------------------------------------------有n个物体,第i个物体的重量是wi,价值为vi,选若干个物体,使得在总重量不超过c的情况下让总价值尽量高。这里每个物体都可以只取走一部分,价值和重量按比例计算。输入:第一行输入两个整数表示n...
分类:其他好文   时间:2014-07-29 10:57:46    阅读次数:400
Minimum Window Substring &&& Longest Substring Without Repeating Characters 快慢指针,都不会退,用hashmap或者其他结构保证
1 public class Solution { 2 public static int lengthOfLongestSubstring(String s) { 3 4 char[] arr = s.toCharArray(); 5 int pre = 0; 6 ...
分类:Windows程序   时间:2014-07-29 10:51:46    阅读次数:355
贪心算法:最优装载问题
/*-----------------------------------------------------给出n个物体,第i个物体的重量为wi。选择尽量多的物体,使得总重量不超过C。 输入:n和C以及n个整数表示的wi。 输出:按照输入物体的顺序输出n个用空格分隔的Y或N。Y表示该物体被选中,N...
分类:其他好文   时间:2014-07-28 23:42:14    阅读次数:265
[LeetCode] Palindrome Partitioning
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
LeetCode "First Missing Positive"
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
Minimum Window Substring leetcode java
题目: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
Substring with Concatenation of All Words leetcode java
题目: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
Longest Substring Without Repeating Characters leetcode java
题目: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
Longest Common Prefix leetcode java
题目: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
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!