Given a binary tree, find its minimum depth.The minimum depth is the number of nodes along the shortest path from the root node down to the nearest le...
分类:
编程语言 时间:
2015-05-23 21:16:50
阅读次数:
170
public class Solution { public int minPathSum(int[][] grid) { if (grid == null || grid.length == 0) { return 0; } i...
分类:
其他好文 时间:
2015-05-23 06:27:29
阅读次数:
87
题目:
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: You can only move either down or...
分类:
编程语言 时间:
2015-05-22 17:12:06
阅读次数:
221
FindMinimuminRotatedSortedArrayTotalAccepted:42341TotalSubmissions:127863MySubmissionsQuestionSolutionSupposeasortedarrayisrotatedatsomepivotunknowntoyoubeforehand.(i.e.,0124567mightbecome4567012).Findtheminimumelement.Youmayassumenoduplicateexistsinthearra..
分类:
其他好文 时间:
2015-05-21 06:48:26
阅读次数:
142
FindMinimuminRotatedSortedArrayIITotalAccepted:25678TotalSubmissions:80978MySubmissionsQuestionSolutionFollowupfor"FindMinimuminRotatedSortedArray":Whatifduplicatesareallowed?Wouldthisaffecttherun-timecomplexity?Howandwhy?Supposeasortedarrayisrotatedatsomep..
分类:
其他好文 时间:
2015-05-21 06:44:54
阅读次数:
162
裸的全局最小割了吧 有重边,用邻接矩阵的时候要小心#include#include#include#include#define MOD 1000000007#define maxn 509using namespace std;int a[590][590],wage[maxn],in[maxn]...
分类:
其他好文 时间:
2015-05-20 23:46:52
阅读次数:
143
1 题目Given a triangle, find the minimum path sum from top to bottom. Each step you may move to adjacent numbers on the row below.For example, given the...
分类:
编程语言 时间:
2015-05-20 23:44:52
阅读次数:
156
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: You can only move either down or right at...
分类:
其他好文 时间:
2015-05-20 18:34:22
阅读次数:
138
Design a stack that supports push, pop, top, and retrieving the minimum element in constant time.push(x) -- Push element x onto stack.pop() -- Removes...
分类:
其他好文 时间:
2015-05-20 18:21:04
阅读次数:
116
【题目】 假定给出一个有n个正整数的数组num和一个正整数s,找出一个子数组使其和sum大于s并返回子数组最小长度。如果不存在就返回0 举例:数组[2,3,1,2,4,3]和s=7 子数组[4,3]满足条件【分析】 1. 首先想到是两层for循环的方式,明显不会AC 2. 优化的方...
分类:
其他好文 时间:
2015-05-20 12:41:31
阅读次数:
108