先上代码。 1 #include 2 #include 3 #include 4 using namespace std; 5 6 class Solution { 7 public: 8 int maxArea(vector &height) { 9 if (hei...
分类:
其他好文 时间:
2014-10-11 00:22:04
阅读次数:
354
动态规划class Solution: # @param triangle, a list of lists of integers # @return an integer def minimumTotal(self, triangle): depth=len(tr...
分类:
其他好文 时间:
2014-10-10 20:59:14
阅读次数:
202
时间限制:0.25s空间限制:4M题意: 有n个人,每个人有两个能力值,只有一个人的两个能力都小于另一个的能力值,这两个人才能共存,求能同时共存的最大人数。Solution: 显然这是一个两个关键字的最长上升序列。 先按照第一种能力值为第一关键字从小到大,第二能力值为第二关键...
分类:
其他好文 时间:
2014-10-10 20:39:24
阅读次数:
276
# Definition for singly-linked list.class ListNode: def __init__(self, x): self.val = x self.next = Noneclass Solution: # @para...
分类:
其他好文 时间:
2014-10-10 19:36:04
阅读次数:
167
发现按照git push 卡住去google,能搜到不少之前同行发的blog有提到,但貌似没有解决的。这个问题在msysgit的最新版已经解决了,希望这个solution扩散出去。让更多的程序猿同学看到。=====================啊啊啊,研究了两天,终于找到solution了。。先仰...
In this Document
Goal
Solution
1: How do you enable trace for an API when executed from a SQL script outside
of Oracle Applications ?
2: H...
分类:
移动开发 时间:
2014-10-10 18:20:14
阅读次数:
273
时间限制:0.25s空间限制:4M题意: 给定一个N*N的棋盘,一些格子被移除,在棋盘上放置一些1*2的骨牌,判定能否放满,并且输出任意方案。Solution: 首先考虑对棋盘的一个格子黑白染色(实际上不需要),得到一个类似国际象棋棋盘的东西,一个骨牌能放置在相邻的一对黑白格子上 ...
分类:
其他好文 时间:
2014-10-09 21:57:37
阅读次数:
273
时间限制:0.5s空间限制:6M题意: 显然就是求一个无源汇有上下界的网络流的可行流的问题Solution:没什么好说的,直接判定可行流,输出就好了code/* 无汇源有上下界的网络流*/#include #include #define ms(a,b) memset(a,b,siz...
分类:
其他好文 时间:
2014-10-09 21:45:37
阅读次数:
169
本题有几个注意点:
1. 回溯找路径时,根据路径的最大长度控制回溯深度
2. BFS时,在找到end单词后,给当前层做标记find=true,遍历完当前层后结束。不需要遍历下一层了。
3. 可以将字典中的单词删除,替代visited的set,这样优化以后时间从1700ms+降到800ms+
代码如下:
class Solution {
public:
vector> findLa...
分类:
其他好文 时间:
2014-10-09 20:13:57
阅读次数:
177
public class Solution { public int ladderLength(String start, String end, Set dict) { if (start == null || end == null || dict == null || start....
分类:
其他好文 时间:
2014-10-09 14:17:14
阅读次数:
202