摘要:
Given a 2D binary matrix filled with 0's and 1's, find the largest rectangle containing all ones and return its area. 阅读全文
摘要:
Givennnon-negative integers representing the histogram's bar height where the width of each bar is 1, find the area of largest rectangle in the histogram.Above is a histogram where width of each bar is 1, given height =[2,1,5,6,2,3].The largest rectangle is shown in the shaded area, which has ar 阅读全文
摘要:
Givennnon-negative integers representing an elevation map where the width of each bar is 1, compute how much water it is able to trap after raining.For example,Given[0,1,0,2,1,0,1,3,2,1,2,1], return6.The above elevation map is represented by array [0,1,0,2,1,0,1,3,2,1,2,1]. In this case, 6 units of 阅读全文
摘要:
Given an unsorted integer array, find the first missing positive integer.For example,Given[1,2,0]return3,and[3,4,-1,1]return2.Your algorithm should run inO(n) time and uses constant space.本题要求在O(n)时间内完成,并且使用O(1)空间O(n)时间则说明要使用hash来解本题,O(1)空间要求不能另开一个数组来进行hash,只能声明变量或者使用输入数组来进行这题是使用输入数组来进行hash本题的输入正整数范 阅读全文