LeetCode

3 已关注
48篇博文
• LeetCode：Search in Rotated Sorted Array

Suppose a sorted array is rotated at some pivot unknown to you beforehand. (i.e., 0 1 2 4 5 6 7 mig...

2015-03-31 10:46
617
• LeetCode：Longest Consecutive Sequence

Given an unsorted array of integers, find the length of the longest consecutive elements sequence. F...

2015-03-30 20:30
647
• LeetCode：Trapping Rain Water

Given n non-negative integers representing an elevation map where the width of each bar is 1, comput...

2015-02-11 12:15
666
• LeetCode：Merge Sorted Array

Given two sorted integer arrays A and B, merge B into A as one sorted array. Note: You may assume ...

2015-02-02 21:58
712
• LeetCode：Pascal's Triangle II

Given an index k, return the kth row of the Pascal's triangle. For example, given k = 3, Return [1...

2015-02-02 21:40
510
• LeetCode：Pascal's Triangle

Given numRows, generate the first numRows of Pascal's triangle. For example, given numRows = 5, Re...

2015-02-02 21:29
516
• LeetCode：Remove Duplicates from Sorted Array II

Follow up for "Remove Duplicates": What if duplicates are allowed at most twice? For example, Given ...

2015-02-01 00:24
450
• LeetCode：Find Minimum in Rotated Sorted Array II

Suppose a sorted array is rotated at some pivot unknown to you beforehand. (i.e., 0 1 2 4 5 6 7 migh...

2015-02-01 00:05
551
• LeetCode：Plus One

Given a non-negative number represented as an array of digits, plus one to the number. The digits a...

2015-01-29 23:00
662
• LeetCode：Set Matrix Zeroes

Given a m x n matrix, if an element is 0, set its entire row and column to 0. Do it in place. click...

2015-01-29 20:17
551
• LeetCode：Search in Rotated Sorted Array II

Follow up for "Search in Rotated Sorted Array": What if duplicates are allowed? Would this affect ...

2015-01-29 19:29
471
• LeetCode：Spiral Matrix II

Given an integer n, generate a square matrix filled with elements from 1 to n2 in spiral order. For...

2015-01-27 22:50
484
• LeetCode：Search a 2D Matrix

Write an efficient algorithm that searches for a value in an m x n matrix. This matrix has the follo...

2015-01-27 22:11
546
• LeetCode：Minimum Path Sum

Given a m x n grid filled with non-negative numbers, find a path from top left to bottom right which...

2015-01-27 21:16
547
• LeetCode：Excel Sheet Column Number

Related to question Excel Sheet Column Title Given a column title as appear in an Excel sheet, retu...

2014-12-29 17:19
675
• LeetCode：Permutations

Given a collection of numbers, return all possible permutations. For example, [1,2,3] have the foll...

2014-12-26 17:58
511
• LeetCode：Container With Most Water

Given n non-negative integers a1, a2, ..., an, where each represents a point at coordinate (i, ai)....

2014-12-26 16:35
391
• 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...

2014-12-26 16:04
610
• LeetCode：Rotate Image

You are given an n x n 2D matrix representing an image. Rotate the image by 90 degrees (clockwise)....

2014-12-25 13:40
437
• LeetCode：Find Peak Element

A peak element is an element that is greater than its neighbors. Given an input array where num[i] ...

2014-12-25 13:12
703