Suppose a sorted array is rotated at some pivot unknown to you beforehand.(i.e., 0 1 2 4 5 6 7 might become 4 5 6 7 0 1 2).Find the minimum element.Yo...
分类:
其他好文 时间:
2014-11-22 11:53:59
阅读次数:
149
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...
分类:
其他好文 时间:
2014-11-22 07:04:11
阅读次数:
193
Follow up for "Find Minimum in Rotated Sorted Array":What if duplicates are allowed?Would this affect the run-time complexity? How and why?Suppose a s...
分类:
其他好文 时间:
2014-11-22 07:03:46
阅读次数:
206
Suppose a sorted array is rotated at some pivot unknown to you beforehand.(i.e., 0 1 2 4 5 6 7 might become 4 5 6 7 0 1 2).Find the minimum element.Yo...
分类:
其他好文 时间:
2014-11-22 07:02:08
阅读次数:
190
The Unique MSTDescriptionGiven a connected undirected graph, tell if its minimum spanning tree is unique.Definition 1 (Spanning Tree): Consider a conn...
分类:
其他好文 时间:
2014-11-20 13:28:58
阅读次数:
202
题目描述:
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 following triangle
[
[2],
...
分类:
其他好文 时间:
2014-11-20 12:03:48
阅读次数:
157
TriangleGiven 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...
分类:
其他好文 时间:
2014-11-20 01:28:14
阅读次数:
180
对于求区间最大最小值,我们自然而然就想到了一个O(n)时间复杂度的算法,但是如果询问有很多呢?这样必然超时。当然我们可以用线段树来解,使得每一次查询的时间降到log(n),但是对于RMQ算法,只要我们做了些预处理,之后的查询我们仅需要O(1)的时间。Sparse_Table算法是解决RMQ问题的一类...
分类:
其他好文 时间:
2014-11-19 23:55:43
阅读次数:
250
问题描述:
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 ...
分类:
其他好文 时间:
2014-11-19 22:23:49
阅读次数:
150
Dynamic ProgrammingGiven a triangle, find the minimum path sum from top to bottom. Each step you may move to adjacent numbers on the row below.For exa...
分类:
其他好文 时间:
2014-11-19 18:18:00
阅读次数:
235