Leetcode_array
佛系城
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
485. Max Consecutive Ones
题目来源【Leetcode】 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 thr原创 2017-07-11 13:12:27 · 269 阅读 · 0 评论 -
66. Plus One
题目来源【Leetcode】 Given a non-negative integer represented as a non-empty array of digits, plus one to the integer. You may assume the integer do not contain any leading zero, except the number原创 2017-07-12 11:05:41 · 187 阅读 · 0 评论 -
118. Pascal's Triangle
题目来源【Leetcode】 Given numRows, generate the first numRows of Pascal’s triangle. For example, given numRows = 5, Return [ [1], [1,1], [1,2,1], [1,3,3,1],原创 2017-07-12 11:37:13 · 161 阅读 · 0 评论 -
119. Pascal's Triangle II
题目来源【Leetcode】 Given an index k, return the kth row of the Pascal’s triangle.For example, given k = 3, Return [1,3,3,1].Note: Could you optimize your algorithm to use only O(k) extra space?原创 2017-07-12 11:50:04 · 203 阅读 · 0 评论 -
26. Remove Duplicates from Sorted Array
题目来源【Leetcode】 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原创 2017-07-12 12:03:16 · 146 阅读 · 0 评论 -
1. Two Sum
题目来源【Leetcode】 Given an array of integers, return indices of the two numbers such that they add up to a specific target. You may assume that each input would have exactly one solution, and yo原创 2017-07-12 12:17:25 · 143 阅读 · 0 评论 -
88. Merge Sorted Array
题目来源【Leetcode】 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原创 2017-07-13 12:31:30 · 161 阅读 · 0 评论 -
605. Can Place Flowers
题目来源【Leetcode】 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原创 2017-07-13 12:55:20 · 157 阅读 · 0 评论 -
581. Shortest Unsorted Continuous Subarray
题目来源【Leetcode】 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原创 2017-07-13 13:25:34 · 170 阅读 · 0 评论 -
27. Remove Element
题目来源【Leetcode】 Given a sorted array and a target value, return the index if the target is found. If not, return the index where it would be if it were inserted in order. You may assume no duplic原创 2017-07-11 15:17:02 · 213 阅读 · 0 评论 -
268. Missing Number
题目来源【Leetcode】 Given an array containing n distinct numbers taken from 0, 1, 2, …, n, find the one that is missing from the array. For example, Given nums = [0, 1, 3] return 2. Note:原创 2017-07-11 15:05:53 · 166 阅读 · 0 评论 -
566. Reshape the Matrix
题目来源【Leetcode】 In MATLAB, there is a very useful function called ‘reshape’, which can reshape a matrix into a new one with different size but keep its original data. You’re given a matrix repres原创 2017-07-11 13:02:41 · 172 阅读 · 0 评论 -
561. Array Partition I
题目来源【Leetcode】 Given an array of 2n integers, your task is to group these integers into n pairs of integer, say (a1, b1), (a2, b2), …, (an, bn) which makes sum of min(ai, bi) for all i from 1 to n as原创 2017-07-11 12:48:59 · 246 阅读 · 0 评论 -
448. Find All Numbers Disappeared in an Array
题目来源【Leetcode】 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原创 2017-07-11 13:26:55 · 272 阅读 · 0 评论 -
283. Move Zeroes
题目来源【Leetcode】 Given an array nums, write a function to move all 0’s to the end of it while maintaining the relative order of the non-zero elements. For example, given nums = [0, 1, 0, 3, 12], a原创 2017-07-11 13:40:43 · 176 阅读 · 0 评论 -
167. Two Sum II - Input array is sorted
题目来源【Leetcode】 Given an array of integers that is already sorted in ascending order, find two numbers such that they add up to a specific target number. The function twoSum should return indices原创 2017-07-11 13:52:47 · 186 阅读 · 0 评论 -
122. Best Time to Buy and Sell Stock II
题目来源【Leetcode】 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 yo原创 2017-07-11 14:29:38 · 182 阅读 · 0 评论 -
628. Maximum Product of Three Numbers
题目来源【Leetcode】 Given an integer array, find three numbers whose product is maximum and output the maximum product. Example 1: Input: [1,2,3] Output: 6 Example 2: Input: [1,2,3,4]原创 2017-07-11 14:42:16 · 176 阅读 · 0 评论 -
217. Contains Duplicate
题目来源【Leetcode】 Given an array of integers, find if the array contains any duplicates. Your function should return true if any value appears at least twice in the array, and it should return false原创 2017-07-11 14:48:43 · 161 阅读 · 0 评论 -
414 Third Maximum Number
题目来源【Leetcode】 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). Exampl原创 2017-07-14 10:40:17 · 181 阅读 · 0 评论
分享