
leetcode之array
文章平均质量分 62
Shawn_Redemption
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
【Leetcode】3Sum (Sum)
Given an array S of n integers, are there elements a, b, c in S such that a + b + c = 0? Find all unique triplets in the array which gives the sum of zero.Note:Elements in a triplet (a,b,c原创 2014-11-07 10:45:02 · 357 阅读 · 0 评论 -
【Leetcode】Pascal's Triangle II (Pascal)
这道题和I差不多,某种程度上它比I还要简单些,因为它是一维的每次zhi'xu'yao原创 2014-10-27 01:48:14 · 313 阅读 · 0 评论 -
【Leetcode】Remove Duplicates from Sorted Array II (Removing)
这道题也是让删除数组里的重复元素,和I原创 2014-10-26 04:47:15 · 313 阅读 · 0 评论 -
【Leetcode】Container With Most Water (Water)
这道题是给了一大堆的高度,然后宽度为array.length-1原创 2014-10-26 08:59:01 · 505 阅读 · 2 评论 -
【Leetcode】Longest Consecutive Sequence
Given an unsorted array of integers, find the length of the longest consecutive elements sequence.For example,Given [100, 4, 200, 1, 3, 2],The longest consecutive elements sequence is [1, 2, 3原创 2014-11-13 04:49:11 · 449 阅读 · 0 评论 -
【Leetcode】Traping Rain Water (Water)
首先定义一个container 长度和A相同原创 2014-10-26 09:34:02 · 424 阅读 · 0 评论 -
【Leetcode】Single Number II (Bit Manipulation)
Given an array of integers, every element appears three times except for one. Find that single one.Note:Your algorithm should have a linear runtime complexity. Could you implement it without usi原创 2014-10-27 04:14:48 · 374 阅读 · 0 评论 -
【Leetcode】Best Time to Buy and Sell Stock II
Say you have an array for which the ith element is the price of a given stock on day i.Design an algorithm to find the maximum profit. You may complete as many transactions as you like (ie, buy on原创 2014-11-03 10:33:01 · 391 阅读 · 0 评论 -
【Leetcode】Largest Rectangle in Histogram (Water)
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 histogram.Above is a histogram where width o原创 2014-10-31 11:51:46 · 386 阅读 · 0 评论 -
【Leetcode】Single Number (Bit Manipulation)
Given an array of integers, every element appears twice except for one. Find that single one.原创 2014-10-27 04:09:31 · 374 阅读 · 0 评论 -
【Leetcode】Pascal's Triangle (Pascal)
Given numRows, generate the first numRows of Pascal's triangle.For example, given numRows = 5,原创 2014-10-27 01:20:16 · 272 阅读 · 0 评论 -
【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.这道题最糟糕的su原创 2014-10-26 04:55:46 · 329 阅读 · 0 评论 -
【Leetcode】3Sum Closest (Sum)
Given an array S of n integers, find three integers in S such that the sum is closest to a given number, target. Return the sum of the three integers. You may assume that each input would have exact原创 2014-11-07 12:19:49 · 301 阅读 · 0 评论 -
【Leetcode】4Sum (Sum)
Given an array S of n integers, are there elements a, b, c, and d in S such that a + b + c + d = target? Find all unique quadruplets in the array which gives the sum of target.Note:Element原创 2014-11-07 13:15:10 · 342 阅读 · 0 评论 -
【Leetcode】Gray Code (Pascal)
The gray code is a binary numeral system where two successive values differ in only one bit.Given a non-negative integer n representing the total number of bits in the code, print the sequence of原创 2014-11-10 00:03:37 · 422 阅读 · 0 评论 -
【Leetcode】Remove Duplicates from Sorted Array (Removing)
Given a sorted array, remove the duplicates in place such that each element appear only once and return the new length.Do not allocate extra space for another array, you must do this in place with原创 2014-10-26 04:27:51 · 319 阅读 · 0 评论 -
【Leetcode】Spiral Matrix II (Rotated)
Given an integer n, generate a square matrix filled with elements from 1 to n2 in spiral order.For example,Given n = 3,You should return the following matrix:[ [ 1, 2, 3 ], [ 8, 9, 4 ], [原创 2014-10-26 07:26:56 · 348 阅读 · 0 评论 -
【Leetcode】Remove Element (Removing)
Given an array and a value, remove all instances of that value in place and return the new length.这道题是让删除特定的元素,所以我们用count来记录特定元素记录的ci'shi原创 2014-10-26 04:20:02 · 325 阅读 · 0 评论 -
【Leetcode】Spiral Matrix (Rotated)
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:[ [ 1, 2, 3 ], [ 4, 5, 6 ], [ 7, 8, 9 ]]原创 2014-10-26 06:52:19 · 362 阅读 · 0 评论 -
【Leetcode】Rotate Image (Rotated)
此题让把一个二维数组顺时针旋转原创 2014-10-26 08:22:44 · 360 阅读 · 0 评论 -
【Leetcode】Two Sum (Sum)
Given an array of integers, find two numbers such that they add up to a specific target number.The function twoSum should return indices of the two numbers such that they add up to the target, whe原创 2014-11-07 09:20:04 · 310 阅读 · 0 评论