问题描述Given an arraynums, there is a sliding window of sizekwhich is moving from the very left of the array to the very right. You can only see theknumb...
Builder Pattern
Separate the construction of a complex object from its representation so that the same construction process can create different representations.
将一个复杂对象的构建与它的表示分离,使得同样的构造过程可以创建...
分类:
其他好文 时间:
2015-07-19 10:18:18
阅读次数:
109
Sliding Window MaximumGiven an arraynums, there is a sliding window of sizekwhich is moving from the very left of the array to the very right. You can...
分类:
编程语言 时间:
2015-07-18 22:42:08
阅读次数:
555
It is possible to write five as a sum in exactly six different ways:
4 + 1
3 + 2
3 + 1 + 1
2 + 2 + 1
2 + 1 + 1 + 1
1 + 1 + 1 + 1 + 1
How many different ways can one hundred be written as a su...
分类:
其他好文 时间:
2015-07-18 18:41:52
阅读次数:
94
It is possible to write ten as the sum of primes in exactly five different ways:
7 + 3
5 + 5
5 + 3 + 2
3 + 3 + 2 + 2
2 + 2 + 2 + 2 + 2
What is the first value which can be written as the sum o...
分类:
其他好文 时间:
2015-07-18 18:40:05
阅读次数:
118
Given an arraynums, there is a sliding window of sizekwhich is moving from the very left of the array to the very right. You can only see theknumbers ...
题目传送门 1 /* 2 思维题:注意题目一句话:At some moment it happened so that they shot one and the same can. 3 如果两个人都有射中的话,肯定一个can同时被打中 4 */ 5 #includ...
分类:
其他好文 时间:
2015-07-18 18:15:05
阅读次数:
126
题目大意:要将一个大矩形內的所有小矩形涂色,涂色要求,只有该矩形上面的所有矩形都涂色了才可以涂该颜色,换一种填涂的颜色就要花费一点体力值,问填涂完需要花费的最小体力值解题思路:先处理一下填涂该矩形的前提条件,我用了一个can数组表示填涂该矩形时要满足的状态量
用dp[color][state]表示当前用的颜色是color,填涂的状态为state时所用的最少体力值
然后暴力得出转换和结果#incl...
分类:
其他好文 时间:
2015-07-18 17:06:05
阅读次数:
143
a typical variant of LCS algo.
the key point here is, the dp[][] array contains enough message to determine the LCS, not only the length, but all of LCS candidates, we can backtrack to find all of LCS....
分类:
其他好文 时间:
2015-07-18 17:03:05
阅读次数:
132
from?https://leetcode.com/problems/sliding-window-maximum/ Given an array?nums, there is a sliding window of size?k?which is moving from the very left of the array to the very right. You can on...