问题Text Justification Given an array of words and a length L, format the text such that each line has exactly L characters and is fully (left and right) justified.You should pack your words in a greedy...
分类:
其他好文 时间:
2015-05-05 22:06:25
阅读次数:
150
真不知道为啥全是英文题。。。就不能好好的出中文的啊 啊 啊
果然看错了题意
#include
#include
using namespace std;
struct node
{
long long day,end;
}c[100005];
bool cmp(node x,node y)
{
if(x.end<y.end) return true;
if(x.end==y....
分类:
其他好文 时间:
2015-05-02 16:34:33
阅读次数:
121
Typical greedy\recursion algorithm.#include #include #include #include #include #include using namespace std;struct Node{ Node() : pinx(0), nodeCnt...
分类:
其他好文 时间:
2015-04-17 15:28:45
阅读次数:
168
WallTime Limit:1000MSMemory Limit:10000KTotal Submissions:31199Accepted:10521DescriptionOnce upon a time there was a greedy King who ordered his chief...
分类:
其他好文 时间:
2015-04-15 10:57:07
阅读次数:
145
一:LeetCode 121 Best
Time to Buy and Sell Stock
题目:
Say you have an array for which the ith element is the price of a given stock on day i.
If you were only permitted to complete at most one t...
分类:
其他好文 时间:
2015-04-11 20:52:40
阅读次数:
213
一、数量词:Greedy?Reluctant?Possessive?? ? ? ? ? ? ? ? ????????String str = "abcdabg";
// ①Greedy
// output:abcdab
Pattern pattern1 = Pattern.compile(".*ab");
Matche...
分类:
其他好文 时间:
2015-04-10 18:18:16
阅读次数:
141
【题目】
Given an array of words and a length L, format the text such that each line has exactly L characters and is fully (left and right) justified.
You should pack your words in a greedy approa...
分类:
其他好文 时间:
2015-04-10 13:45:11
阅读次数:
199
一:Jump Game
题目:
Given an array of non-negative integers, you are initially positioned at the first index of the array.
Each element in the array represents your maximum jump length at that posi...
分类:
其他好文 时间:
2015-04-10 13:37:59
阅读次数:
197
Given an array of words and a length L, format the text such that each line has exactly L characters and is fully (left and right) justified.
You should pack your words in a greedy approach; that i...
分类:
其他好文 时间:
2015-04-07 17:40:50
阅读次数:
137
Best Time to Buy and Sell Stock I题意:用一个数组表示股票每天的价格,数组的第i个数表示股票在第i天的价格。 如果只允许进行一次交易,也就是说只允许买一支股票并卖掉,求最大的收益。分析:动态规划法。从前向后遍历数组,记录当前出现过的最低价格,作为买入价格,并计算以当天价格出售的收益,作为可能的最大收益,整个遍历过程中,出现过的最大收益就是所求。**代码:**O(n)时...
分类:
其他好文 时间:
2015-04-06 11:28:27
阅读次数:
142