- 博客(18)
- 收藏
- 关注
原创 Triangle -- Leetcode
12.27 2014 Given 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 [ [2],
2014-12-28 12:06:10 249
原创 Search for a Range -- Leetcode
12.26 2014 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). If the targ
2014-12-27 09:42:48 183
原创 Subsets -- Leetcode
12.26 2014 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 not contain duplicate subsets
2014-12-27 07:44:50 177
原创 Merge Sorted Array
12.25 2014 Given two sorted integer arrays A and B, merge B into A as one sorted array. Note: You may assume that A has enough space (size that is greater or equal to m + n) to hold additiona
2014-12-26 18:39:13 176
原创 Search a 2D Matrix -- Leetcode
12.25 2014 Write an efficient algorithm that searches for a value in an m x n matrix. This matrix has the following properties: Integers in each row are sorted from left to right.The first
2014-12-26 18:17:00 172
原创 Best Time to Buy and Sell Stock III -- Leetcode
12.25 2014 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 at most two transactions.
2014-12-26 16:16:22 166
原创 Find Minimum in Rotated Sorted Array
12.25 2014 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). Find the minimum element. You may assume no dupl
2014-12-26 06:01:43 146
原创 Sort Colors -- Leetcode
12.24 2014 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 red, white and blue. Here, we will use
2014-12-25 17:01:23 250
原创 Maximum Subarray -- Leetcode
12.24 2012 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,−1,2,1,−5,4], the contiguous subarray
2014-12-25 15:41:42 159
原创 Next Permutation -- Leetcode
12.22 2014 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
2014-12-23 14:58:04 165
原创 Two Sum -- Leetcode
12.22 2014 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
2014-12-23 11:59:12 152
原创 3Sum -- Leetcode
12.22 2014 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
2014-12-23 11:48:43 189
原创 Longest Consecutive Sequence -- Leetcode
12.21 2014 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 sequen
2014-12-22 14:15:09 150
原创 Median of Two Sorted Arrays -- Leetcode
12.21 2014 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)). class Solution { pu
2014-12-22 12:56:58 188
原创 Search in Rotated Sorted Array II -- Leetcode
Follow up for "Search in Rotated Sorted Array": What if duplicates are allowed? Would this affect the run-time complexity? How and why? Write a function to determine if a given target is in the
2014-12-22 12:30:48 151
原创 Search in Rotated Sorted Array -- Leetcode
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 to search. If found in the array retur
2014-12-22 12:04:55 133
原创 Remove Duplicates from Sorted Array II -- Leetcode
Remove Duplicates from Sorted Array II 12.21 2014 Follow up for "Remove Duplicates": What if duplicates are allowed at most twice? For example, Given sorted array A = [1,1,1,2,2,3],
2014-12-22 11:49:43 130
原创 Remove Duplicates from Sorted Array -- Leetcode
Remove Duplicates from Sorted Array 12.21 2014 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
2014-12-22 11:17:49 159
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人