题目描述: 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 ...

2018-08-09 23:32:06

阅读数 82

评论数 0


题目描述:Given a set of distinct integers, S, return all possible subsets.Note:Elements in a subset must be in non-descending order.The solution set must...

2018-07-15 00:13:04

阅读数 344

评论数 0


题目描述:Given an array with n objects colored red, white or blue, sort them so that objects of the same color are adjacent, with the colors in the order...

2018-07-14 00:18:26

阅读数 202

评论数 0


题目描述:Write an efficient algorithm that searches for a value in anm x n matrix. This matrix has the following properties:Integers in each row are sort...

2018-07-13 23:48:44

阅读数 108

评论数 0


题目描述:Given a m x n matrix, if an element is 0, set its entire row and column to 0. Do it in place.click to show follow up.Follow up:Did you use extra...

2018-07-13 23:03:54

阅读数 97

评论数 0


题目描述:Given a number represented as an array of digits, plus one to the number.思路解析:计算加1后的数值高位在数组的开头,所以要从数组的最后开始检查每一位数字是不是小于9,如果是的话,直接加9就行了如果是小于9的就不用循...

2018-07-13 00:37:54

阅读数 66

评论数 0


unique-paths题目描述:A robot is located at the top-left corner of a m x n grid (marked 'Start' in the diagram below).The robot can only move either down ...

2018-07-12 19:06:01

阅读数 50

评论数 0


题目描述:The set[1,2,3,…,n]contains a total of n! unique permutations.By listing and labeling all of the permutations in order,We get the following seque...

2018-07-08 00:05:32

阅读数 287

评论数 0


题目描述:Given an integer n, generate a square matrix filled with elements from 1 to n 2 in spiral order.For example,Given n =3,You should return the fol...

2018-07-06 00:14:22

阅读数 61

评论数 0


题目描述:Given a set of non-overlapping intervals, insert a new interval into the intervals (merge if necessary).You may assume that the intervals were i...

2018-07-05 23:39:40

阅读数 148

评论数 0


题目描述:Given a collection of intervals, merge all overlapping intervals.For example,Given[1,3],[2,6],[8,10],[15,18],return[1,6],[8,10],[15,18].思路解析:题意:...

2018-07-05 01:17:17

阅读数 386

评论数 0


题目描述:Given a matrix of m x n elements (m rows, n columns), return all elements of the matrix in spiral order.For example,Given the following matrix:[...

2018-07-05 00:28:11

阅读数 284

评论数 0


题目描述: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,−...

2018-06-28 22:01:54

阅读数 167

评论数 0


题目描述:Follow up for N-Queens problem.Now, instead outputting board configurations, return the total number of distinct solutions.思路解析:跟第一个题一样的解决方法,但是需...

2018-06-28 19:19:04

阅读数 59

评论数 0


题目描述:The n-queens puzzle is the problem of placing n queens on an n×n chessboard such that no two queens attack each other.Given an integer n, return...

2018-06-28 18:05:28

阅读数 414

评论数 0


题目描述:You are given an n x n 2D matrix representing an image.Rotate the image by 90 degrees (clockwise).Follow up:Could you do this in-place?思路解析:旋转赋值...

2018-06-21 21:33:51

阅读数 189

评论数 0


题目描述:Given a collection of numbers that might contain duplicates, return all possible unique permutations.For example,[1,1,2]have the following uniqu...

2018-06-21 20:44:49

阅读数 185

评论数 0


题目描述:Given a collection of numbers, return all possible permutations.For example,[1,2,3]have the following permutations:[1,2,3],[1,3,2],[2,1,3],[2,3,...

2018-06-21 20:03:16

阅读数 62

评论数 0


题目描述:Given an array of non-negative integers, you are initially positioned at the first index of the array.Each element in the array represents your ...

2018-06-21 17:17:08

阅读数 653

评论数 0


题目描述:Given an array of non-negative integers, you are initially positioned at the first index of the array.Each element in the array represents your ...

2018-06-21 16:15:04

阅读数 271

评论数 0

取消 删除