Array
Yingying_code
这个作者很懒,什么都没留下…
展开
-
485. Max Consecutive Ones*
Given a binary array, find the maximum number of consecutive 1s in this array. Example 1: Input: [1,1,0,1,1,1] Output: 3 Explanation: The first two digits or the last three digits are consecutiv原创 2017-01-15 14:36:25 · 809 阅读 · 0 评论 -
447. Number of Boomerangs*
Given n points in the plane that are all pairwise distinct, a "boomerang" is a tuple of points (i, j, k) such that the distance between iand j equals the distance between i and k (the order of t原创 2017-01-16 09:48:06 · 205 阅读 · 0 评论 -
120. Triangle**
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], [3,4], [原创 2017-01-15 18:48:46 · 216 阅读 · 0 评论 -
229. Majority Element II**
Given an integer array of size n, find all elements that appear more than ⌊ n/3 ⌋ times. The algorithm should run in linear time and in O(1) space. Hint: How many majority elements could it po原创 2017-01-15 18:33:10 · 174 阅读 · 0 评论 -
152. 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 contiguous subarray [2,3] has the larges原创 2017-01-15 16:56:09 · 223 阅读 · 0 评论 -
216. Combination Sum III**
Find all possible combinations of k numbers that add up to a number n, given that only numbers from 1 to 9 can be used and each combination should be a unique set of numbers. Example 1: Inpu原创 2017-01-15 16:42:57 · 193 阅读 · 0 评论 -
448. Find All Numbers Disappeared in an Array*
Given an array of integers where 1 ≤ a[i] ≤ n (n = size of array), some elements appear twice and others appear once. Find all the elements of [1, n] inclusive that do not appear in this array.原创 2017-01-15 16:26:35 · 189 阅读 · 0 评论 -
88. Merge Sorted Array*
Given two sorted integer arrays nums1 and nums2, merge nums2 into nums1 as one sorted array. Note: You may assume that nums1 has enough space (size that is greater or equal to m + n) to hold addit原创 2017-01-15 16:10:44 · 173 阅读 · 0 评论 -
414. Third Maximum Number*
Given a non-empty array of integers, return the third maximum number in this array. If it does not exist, return the maximum number. The time complexity must be in O(n). Example 1: Input: [3, 2,原创 2017-01-15 15:35:04 · 394 阅读 · 0 评论 -
334. Increasing Triplet Subsequence**
Given an unsorted array return whether an increasing subsequence of length 3 exists or not in the array. Formally the function should: Return true if there exists i, j, k such that arr[i] ar原创 2017-01-23 13:14:51 · 198 阅读 · 0 评论