Find the contiguous subarray within an array (containing at least one number) which has the largest sum. For example, given the array [-2,1,-3,4,-1,2, ...
分类:
其他好文 时间:
2017-06-12 20:40:29
阅读次数:
155
Red and Black Description There is a rectangular room, covered with square tiles. Each tile is colored either red or black. A man is standing on a bla ...
分类:
其他好文 时间:
2017-06-10 21:35:27
阅读次数:
245
題目:給你一個整數n(不超過14位)。求出他的最大的素數因子。假设仅仅有一個素數因子輸出-1。 分析:數論。直接打表計算10^7內的全部素數因子,然後用短除法除n。記錄最大的因子就可以。 假设最後下的數字不是1,則它就是最大的素數因子。 說明:注意n可能為負數。 #include <algorith ...
分类:
其他好文 时间:
2017-06-08 10:45:40
阅读次数:
121
https://github.com/Premiumlab/Python-for-Algorithms--Data-Structures--and-Interviews/blob/master/Mock%20Interviews/Ride%20Share%20Start-Up%20Company/R ...
分类:
其他好文 时间:
2017-06-08 10:31:05
阅读次数:
235
题意:平面上有 n (2 ≤ n ≤ 15) 个点,现用平行于坐标轴的矩形去覆盖所有点,每个矩形至少盖两个点,矩形面积不可为0,求这些矩形的最小面积。 析:先预处理所有的矩形,然后dp[s] 表示 状态 s 时,最少需要的面积是多少。 代码如下: ...
分类:
其他好文 时间:
2017-06-05 23:41:10
阅读次数:
213
题目描述 Given n non-negative integers representing the histogram's bar height where the width of each bar is 1, find the area of largest rectangle in the ...
分类:
其他好文 时间:
2017-06-04 11:39:55
阅读次数:
182
题目描述 You are given a node-labeled rooted tree with n nodes. Define the query (x, k): Find the node whose label is k-th largest in the subtree of the n ...
分类:
其他好文 时间:
2017-06-03 21:46:27
阅读次数:
186
https://leetcode.com/problems/trapping-rain-water/ 思路一:参考 84. Largest Rectangle in Histogram,用 stack 做辅助 思路二:dynamic programming ...
分类:
移动开发 时间:
2017-06-02 17:23:41
阅读次数:
178
Node: Quick Select: Avg O(N) Thought: put all the element less(more) than pivot to the first part, the rest to the second part. And Kth only falls to ...
分类:
其他好文 时间:
2017-06-02 09:54:10
阅读次数:
209
Given a 2D binary matrix filled with 0's and 1's, find the largest square containing all 1's and return its area.For example, given the following matr ...
分类:
其他好文 时间:
2017-05-31 22:17:52
阅读次数:
264