Be carefully with one element and two element sitution.1. Since mid = (start + end) / 2 is alway shifting to the left. So when we do comparision, not ...
分类:
其他好文 时间:
2015-03-19 10:01:34
阅读次数:
141
The minimum height controls the volumns. So let two runner at two ends start to scan the array. 1 class Solution { 2 public: 3 int maxArea(vector ...
分类:
其他好文 时间:
2015-03-19 06:21:12
阅读次数:
147
Follow upfor "Find Minimum in Rotated Sorted Array":What ifduplicatesare allowed?Would this affect the run-time complexity? How and why?Suppose a sort...
分类:
其他好文 时间:
2015-03-18 00:52:51
阅读次数:
202
Suppose a sorted array is rotated at some pivot unknown to you beforehand.(i.e.,0 1 2 4 5 6 7might become4 5 6 7 0 1 2).Find the minimum element.You m...
分类:
其他好文 时间:
2015-03-17 23:33:11
阅读次数:
149
/** * Definition for binary tree * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * TreeNode(int x) : val(x), left(...
分类:
其他好文 时间:
2015-03-17 20:01:14
阅读次数:
98
Suppose a sorted array is rotated at some pivot unknown to you beforehand.(i.e.,0 1 2 4 5 6 7might become4 5 6 7 0 1 2).Find the minimum element.You m...
分类:
其他好文 时间:
2015-03-16 23:07:35
阅读次数:
221
A gas station has to be built at such a location that the minimum distance between the station and any of the residential housing is as far away as po...
分类:
其他好文 时间:
2015-03-16 12:51:44
阅读次数:
137
Given a string S and a string T, find the minimum window in S which will contain all the characters in T in complexity O(n).For example,S="ADOBECODEBA...
题目链接:Minimum Path Sum
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 ei...
分类:
其他好文 时间:
2015-03-15 23:44:17
阅读次数:
329
Problem DescriptionThese are N cities in Spring country. Between each pair of cities there may be one transportation track or none. Now there is some ...
分类:
其他好文 时间:
2015-03-15 19:36:48
阅读次数:
135