Leetcode(线性表)
luxialan
这个作者很懒,什么都没留下…
展开
-
Search in Rotated Sorted Array
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 might become 4 5 6 7 0 1 2).You are given a target value原创 2015-01-29 10:23:15 · 396 阅读 · 0 评论 -
Remove Duplicates from Sorted Array II
Remove Duplicates from Sorted Array IIFollow up for "Remove Duplicates":What if duplicates are allowed at most twice?For example,Given sorted array A = [1,1,1,2,2,3],Your f原创 2015-03-25 21:20:32 · 389 阅读 · 0 评论 -
Gas Station
Gas Station There are N gas stations along a circular route, where the amount of gas at station i is gas[i].You have a car with an unlimited gas tank and it costs cost[i] of gas to travel原创 2015-02-15 11:06:26 · 543 阅读 · 0 评论 -
3Sum
3SumGiven 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原创 2015-02-04 10:51:03 · 432 阅读 · 0 评论 -
Valid Sudoku
Valid SudokuDetermine if a Sudoku is valid, according to: Sudoku Puzzles - The Rules.The Sudoku board could be partially filled, where empty cells are filled with the character '.'原创 2015-02-04 22:05:56 · 466 阅读 · 0 评论 -
Median of Two Sorted Arrays
Median of Two Sorted Arrays There are two sorted arrays A and B of size m and n respectively. Find the median of the two sorted arrays. The overall run time complexity should be O(log (m+n)).原创 2015-02-04 09:05:52 · 420 阅读 · 0 评论 -
Two Sum
Two SumGiven 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 th原创 2015-02-04 10:05:25 · 427 阅读 · 0 评论 -
Longest Consecutive Sequence
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 cons原创 2015-02-04 09:54:44 · 429 阅读 · 0 评论 -
Remove Element
Given an array and a value, remove all instances of that value in place and return the new length.The order of elements can be changed. It doesn't matter what you leave beyond the new length.这原创 2015-01-29 10:47:18 · 399 阅读 · 0 评论 -
Remove Duplicates from Sorted Array
Remove Duplicates from Sorted ArrayGiven 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 anot原创 2015-03-25 16:10:10 · 387 阅读 · 0 评论