Array
文章平均质量分 70
jialuyyy
这个作者很懒,什么都没留下…
展开
-
Next Permutation
Implement next permutation, which rearranges numbers into the lexicographically next greater permutation of numbers.If such arrangement is not possible, it must rearrange it as the lowest possible原创 2015-05-28 10:22:36 · 197 阅读 · 0 评论 -
Search for a Range
Search for a Range Given a sorted array of integers, find the starting and ending position of a given target value.Your algorithm's runtime complexity must be in the order of O(log n).原创 2015-06-13 08:06:46 · 195 阅读 · 0 评论 -
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-06-13 05:00:52 · 173 阅读 · 0 评论 -
Insert Interval
Insert IntervalGiven a set of non-overlapping intervals, insert a new interval into the intervals (merge if necessary).You may assume that the intervals were initially sorted according to th原创 2015-07-09 22:40:35 · 179 阅读 · 0 评论 -
Largest Rectangle in Histogram
Largest Rectangle in HistogramGiven 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 histogra原创 2015-07-08 22:04:37 · 205 阅读 · 0 评论 -
Read N Characters Given Read4
The API: int read4(char *buf) reads 4 characters at a time from a file.The return value is the actual number of characters read. For example, it returns 3 if there is only 3 characters left in the原创 2015-07-08 23:46:57 · 312 阅读 · 0 评论 -
plus one
Plus OneGiven a non-negative number represented as an array of digits, plus one to the number.The digits are stored such that the most significant digit is at the head of the list.原创 2015-06-09 22:52:24 · 171 阅读 · 0 评论 -
summary ranges
Summary RangesGiven a sorted integer array without duplicates, return the summary of its ranges.For example, given [0,1,2,4,5,7], return ["0->2","4->5","7"].Credits:Special thanks to @原创 2015-06-30 03:56:51 · 298 阅读 · 0 评论 -
Maximum Product Subarray
Maximum Product Subarray Find the contiguous subarray within an array (containing at least one number) which has the largest product.For example, given the array [2,3,-2,4],the contiguou原创 2015-06-05 02:25:45 · 188 阅读 · 0 评论 -
Missing Ranges
Missing RangesGiven a sorted integer array where the range of elements are [lower, upper] inclusive, return its missing ranges.For example, given [0, 1, 3, 50, 75], lower = 0 and u原创 2015-06-19 23:25:25 · 184 阅读 · 0 评论 -
Triangle
TriangleGiven a triangle, find the minimum path sum from top to bottom. Each step you may move to adjacent numbers on the row below.For example, given the following triangle[原创 2015-06-21 05:01:54 · 194 阅读 · 0 评论 -
Remove Duplicates from Sorted Array I, II
Remove Duplicates from Sorted Array IIFollow up for "Remove Duplicates":What if duplicates are allowed at most twice?For example,Given sorted array nums = [1,1,1,2,2,3],You原创 2015-06-19 06:13:13 · 264 阅读 · 0 评论 -
Remove Specified Characters
Remove Specified CharactersWrite an efficient function in JAVA that deletes characters from a string. Use the prototype string removeChars( string str, string remove ); where any character existin原创 2015-07-13 00:36:03 · 260 阅读 · 0 评论