![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
LC-Array
seven_-
这个作者很懒,什么都没留下…
展开
-
<easy>LeetCode Problem -- 561. Array Partition I
描述: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 large as poss原创 2018-01-31 14:26:11 · 125 阅读 · 0 评论 -
<easy>LeetCode Problem -- 628. Maximum Product of Three Numbers
描述: Given an integer array, find three numbers whose product is maximum and output the maximum product.Example 1: Input: [1,2,3] Output: 6Example 2: Input: [1,2,3,4] Output: 24分析:找出给定数组中三个原创 2018-02-03 20:22:43 · 132 阅读 · 0 评论 -
<easy>LeetCode Problem -- 268. Missing Number
描述:Given an array containing n distinct numbers taken from 0, 1, 2, …, n, find the one that is missing from the array.Example 1 Input: [3,0,1] Output: 2Example 2 Input: [9,6,4,2,3,5,7,0,1]原创 2018-02-03 20:35:18 · 124 阅读 · 0 评论 -
<easy>LeetCode Problem -- 747. Largest Number At Least Twice of Others
描述:In a given integer array nums, there is always exactly one largest element.Find whether the largest element in the array is at least twice as much as every other number in the array.If it is, retur原创 2018-02-03 21:01:15 · 162 阅读 · 0 评论 -
<easy>LeetCode Problem -- 674. Longest Continuous Increasing Subsequence
描述:Given an unsorted array of integers, find the length of longest continuous increasing subsequence (subarray).Example 1: Input: [1,3,5,4,7] Output: 3 Explanation: The longest continuous incr原创 2018-02-09 18:01:51 · 135 阅读 · 0 评论 -
<medium>LeetCode Problem -- 769. Max Chunks To Make Sorted
描述: Given an array arr that is a permutation of [0, 1, …, arr.length - 1], we split the array into some number of “chunks” (partitions), and individually sort each chunk. After concatenating them, th原创 2018-02-05 17:28:24 · 173 阅读 · 0 评论 -
<medium>LeetCode Problem -- 714. Best Time to Buy and Sell Stock with Transaction Fee
描述:Your are given an array of integers prices, for which the i-th element is the price of a given stock on day i; and a non-negative integer fee representing a transaction fee.You may complete as many原创 2018-02-05 18:51:50 · 97 阅读 · 0 评论 -
<medium>LeetCode Problem -- 287. Find the Duplicate Number
描述:Given an array nums containing n + 1 integers where each integer is between 1 and n (inclusive), prove that at least one duplicate number must exist. Assume that there is only one duplicate number,原创 2018-02-05 19:25:13 · 156 阅读 · 0 评论 -
Divide and Conquer -- Leetcode problem240. Search a 2D Matrix II
描述: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 in ascending from left to right. Integers i原创 2017-09-18 13:37:35 · 617 阅读 · 0 评论 -
<easy>LeetCode Problem -- 219. Contains Duplicate II
描述:Given an array of integers and an integer k, find out whether there are two distinct indices i and j in the array such that nums[i] = nums[j] and the absolute difference between i and j is at most原创 2018-02-06 16:58:46 · 131 阅读 · 0 评论 -
<easy>LeetCode Problem -- 121. Best Time to Buy and Sell Stock
描述:Say you have an array for which the ith element is the price of a given stock on day i.If you were only permitted to complete at most one transaction (ie, buy one and sell one share of the stock原创 2018-02-06 17:16:42 · 108 阅读 · 0 评论 -
<medium>LeetCode Problem -- 78. Subsets
描述:Given a set of distinct integers, nums, return all possible subsets (the power set).Note: The solution set must not contain duplicate subsets.For example, If nums = [1,2,3], a solution is: [原创 2018-02-19 14:23:18 · 131 阅读 · 0 评论 -
<easy>LeetCode Problem -- 27. Remove Element
描述:Given an array and a value, remove all instances of that value in-place and return the new length.Do not allocate extra space for another array, you must do this by modifying the input array in-pla原创 2018-02-21 13:54:33 · 124 阅读 · 0 评论 -
<easy>LeetCode Problem -- 26. Remove Duplicates from Sorted Array
描述:Given a sorted array nums, 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 do this by mod...原创 2019-01-04 10:16:30 · 87 阅读 · 0 评论 -
<easy>LeetCode Problem -- 661. Image Smoother
描述:Given a 2D integer matrix M representing the gray scale of an image, you need to design a smoother to make the gray scale of each cell becomes the average gray scale (rounding down) of all the 8 sur原创 2018-02-03 19:08:47 · 158 阅读 · 0 评论 -
<easy>LeetCode Problem -- 217. Contains Duplicate
描述: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 if every element原创 2018-02-03 18:12:06 · 131 阅读 · 0 评论 -
<easy>LeetCode Problem -- 766. Toeplitz Matrix
描述:A matrix is Toeplitz if every diagonal from top-left to bottom-right has the same element.Now given an M x N matrix, return True if and only if the matrix is Toeplitz. Example 1: Input: matrix =原创 2018-01-31 16:10:34 · 144 阅读 · 0 评论 -
<easy>LeetCode Problem -- 566. Reshape the Matrix
描述: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 represented by a two-dime原创 2018-01-31 16:58:01 · 152 阅读 · 0 评论 -
<easy>LeetCode Problem -- 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 conse原创 2018-02-01 15:46:57 · 162 阅读 · 0 评论 -
<medium>LeetCode Problem -- 442. Find All Duplicates in an Array
描述:Given an array of integers, 1 ≤ a[i] ≤ n (n = size of array), some elements appear twice and others appear once.Find all the elements that appear twice in this array. Example: Input: [4,原创 2018-01-31 17:59:52 · 131 阅读 · 0 评论 -
<easy>LeetCode Problem -- 695. Max Area of Island
描述:Given a non-empty 2D array grid of 0’s and 1’s, an island is a group of 1’s (representing land) connected 4-directionally (horizontal or vertical.) You may assume all four edges of the grid are surr原创 2018-02-01 16:27:37 · 119 阅读 · 0 评论 -
<medium>LeetCode Problem -- 667. Beautiful Arrangement II
描述:Given two integers n and k, you need to construct a list which contains n different positive integers ranging from 1 to n and obeys the following requirement: Suppose this list is [a1, a2, a3, … ,原创 2018-02-01 17:13:37 · 203 阅读 · 0 评论 -
<medium>LeetCode Problem -- 495. Teemo Attacking
描述:In LOL world, there is a hero called Teemo and his attacking can make his enemy Ashe be in poisoned condition. Now, given the Teemo’s attacking ascending time series towards Ashe and the poisoning t原创 2018-02-01 17:50:40 · 163 阅读 · 0 评论 -
<easy>LeetCode Problem -- 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.原创 2018-02-01 18:26:42 · 132 阅读 · 0 评论 -
<easy>LeetCode Problem -- 283. Move Zeroes
描述: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], after calling your f原创 2018-02-02 17:26:23 · 122 阅读 · 0 评论 -
<medium>LeetCode Problem -- 238. Product of Array Except Self
描述:Given an array of n integers where n > 1, nums, return an array output such that output[i] is equal to the product of all the elements of nums except nums[i].Solve it without division and in O(n).F原创 2018-02-02 18:01:58 · 141 阅读 · 0 评论 -
<easy>LeetCode Problem -- 717. 1-bit and 2-bit Characters
描述:We have two special characters. The first character can be represented by one bit 0. The second character can be represented by two bits (10 or 11).Now given a string represented by several bits. R原创 2018-02-02 20:14:59 · 184 阅读 · 0 评论 -
<medium>LeetCode Problem -- 565. Array Nesting
描述:A zero-indexed array A of length N contains all integers from 0 to N-1. Find and return the longest length of set S, where S[i] = {A[i], A[A[i]], A[A[A[i]]], … } subjected to the rule below.Suppose原创 2018-02-02 20:49:52 · 141 阅读 · 0 评论 -
<easy>LeetCode Problem -- 167. Two Sum II - Input array is sorted
描述: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 of the two numbers原创 2018-02-03 16:04:39 · 150 阅读 · 0 评论 -
<easy>LeetCode Problem -- 136. Single Number
描述:Given a non-empty array of integers, every element appears twice except for one. Find that single one.Note:Your algorithm should have a linear runtime complexity. Could you implement it without...原创 2019-01-05 14:04:39 · 134 阅读 · 0 评论