leetcode
青冥blue
希望成长的渣硕
展开
-
LeetCode-Best Time to Buy and Sell Stock
原题描述:Say you have an array for which the ith element is the price of a given stock on day i.If you were only permitted to complete at most one transaction (ie, buy one and sell one share of the stock)原创 2017-09-30 10:42:14 · 138 阅读 · 0 评论 -
LeetCode-矩阵旋转
题目描述:给定一个 n×nn×n的2D矩阵,将其顺时针旋转90度。不能开辟新的矩阵空间 example:given input matrix=[ [1,2,3], [4,5,6], [7,8,9]] rotate the input matrix in place that it becomes:[ [7,4,1], [8,5,2],原创 2017-10-01 14:12:01 · 795 阅读 · 0 评论 -
Find Minimum in Rotated Sorted Array II
leetcode上面刷题时遇到的第一个hard类型,花了很长的时间推导公式,得出结论,最终领悟到题目的精髓之后才知道:要转动脑子呀,搞复杂了!题目suppose an array sorted in ascending order is rotated at some pivot unknown to you heforehand.(i.e..,0 1 2 4 5 6 7 might become原创 2017-10-01 22:56:48 · 180 阅读 · 0 评论 -
Trapping rain water
题目描述这道题可以借鉴直方图中求最大矩形面积的思想,是一道非常经典的题目,难度非常大,但是又经常在面试中出现。 Given n non-negative integers representing an elevation map where the width of each bar is 1, compute how much water it is able to trap after rai原创 2017-10-03 21:08:15 · 154 阅读 · 0 评论