这题首先要注意的是两个字符串,Interleave得到一个新的字符串,原来字符串中的字符的顺序是不会改变的。试想,如果枚举s1和s2所能组成的所有字符串,那将是很恐怖的。因为两个字串中的顺序不变,如果能将之类比Minimum Path Sum中,一个m X n的网格,从左上角走到右下角的过程,事情就...
分类:
其他好文 时间:
2014-10-11 21:38:06
阅读次数:
177
Minimum Depth of Binary Tree
Total Accepted: 25609 Total
Submissions: 86491My Submissions
Given a binary tree, find its minimum depth.
The minimum depth is the number of nodes along the ...
分类:
其他好文 时间:
2014-10-11 17:41:25
阅读次数:
151
unrest n.动荡,不安定;骚乱;风潮;乱腾resultin后面加的是导致的结果resultfrom后面加的是导致的原因deadly adj. 极端的minimum n. 最小 adj. 最小的wage n. 薪水garment n.衣服;服装 v.给…穿衣服raise to提到, 提升到dis...
分类:
其他好文 时间:
2014-10-11 12:01:05
阅读次数:
164
Description
Tingting wants to draw and stucco N squares with N different colors full of the base line of a wall.
Give you the number of squares, the length of the wall, the minimum size and the ...
分类:
其他好文 时间:
2014-10-10 23:42:34
阅读次数:
344
动态规划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
很多时候,我们需要做一些图像生成工作(譬如验证码之类的),这时候,我们一般都需要用到系统的字体库。但事情却总非尽善人意,我们所使用的Linux操作系统无法像Windows操作系统那样足够“旗舰”,字体这种东西,分分钟都是缺失的(譬如我们选择Minimum方式安装或者没有选择Chinese Sup.....
分类:
其他好文 时间:
2014-10-10 00:25:31
阅读次数:
358
1.概述RMQ(Range Minimum/Maximum Query),即区间最值查询,是指这样一个问题:对于长度为n的数列A,回答若干询问RMQ(A,i,j)(i,jO(nlogn){for(int j = 1; j #include #include using namespace std;c...
分类:
其他好文 时间:
2014-10-09 23:36:27
阅读次数:
627
此题不难,可以用dfs来做,也可以用动态规划,但明显dfs性能不如dp。
Given a m x n grid filled with non-negative numbers, find a path from top left to bottom right which minimizes the sum of all numbers along its path.
Note:...
分类:
编程语言 时间:
2014-10-09 15:59:48
阅读次数:
163
Given two words word1 and word2, find the minimum number of steps required to convert word1 to word2. (each operation is counted as 1 step.)You have t...
分类:
其他好文 时间:
2014-10-08 07:40:24
阅读次数:
228
题目地址:Minimum Inversion Number题目大意: 求逆序对数,求循环移位后逆序数的最小值,意思一次将第一位移到最后一位,然后计算逆序对数,求出最小的那个。解题思路: 因为是序列0->n-1区间的数,所以当你求的,它给出的a1.a2...an-1的逆序对数时cnt,推出如果移位.....
分类:
其他好文 时间:
2014-10-07 17:30:13
阅读次数:
235