![](https://img-blog.csdnimg.cn/20201014180756757.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
#Array
TechJungle
这个作者很懒,什么都没留下…
展开
-
LeetCode Array 289 Game of Life
289. Game of Life (Medium)According to the Wikipedia’s article: “The Game of Life, also known simply as Life, is a cellular automaton devised by the British mathematician John Horton Conway in 1970.”...原创 2019-12-21 09:19:26 · 101 阅读 · 0 评论 -
LeetCode Array 287 Find the Duplicate Number
287. Find the Duplicate NumberGiven 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 i...原创 2019-11-18 13:43:24 · 87 阅读 · 0 评论 -
LeetCode Array 164 Maximum Gap
164. Maximum GapGiven an unsorted array, find the maximum difference between the successive elements in its sorted form.Return 0 if the array contains less than 2 elements.Example 1:Input: [3,6,9...原创 2019-11-18 05:40:42 · 96 阅读 · 0 评论 -
LeetCode Array 128 Longest Consecutive Sequence
128. Longest Consecutive SequenceGiven an unsorted array of integers, find the length of the longest consecutive elements sequence.Your algorithm should run in O(n) complexity.Example:Input: [100,...原创 2019-11-17 11:02:20 · 116 阅读 · 0 评论 -
LeetCode Array 334 Increasing Triplet Subsequence
334. Increasing Triplet SubsequenceGiven 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...原创 2019-11-17 08:52:27 · 94 阅读 · 0 评论 -
LeetCode Array 42 Trapping Rain Water
42. Trapping Rain WaterGiven n non-negative integers representing an elevation map where the width of each bar is 1, compute how much water it is able to trap after raining.The above elevation map ...原创 2019-11-17 08:02:15 · 78 阅读 · 0 评论 -
LeetCode Array 189 Rotate Array
189. Rotate ArrayGiven an array, rotate the array to the right by k steps, where k is non-negative.Example 1:Input: [1,2,3,4,5,6,7] and k = 3Output: [5,6,7,1,2,3,4]Explanation:rotate 1 steps to...原创 2019-11-16 14:53:33 · 86 阅读 · 0 评论 -
LeetCode Array 134 Gas Station
134. Gas StationThere are N gas stations along a circular route, where the amount of gas at station i is gas[i]. You have a car with an unlimited gas tank and it costs cost[i] of gas to travel from s...原创 2019-11-16 14:51:50 · 93 阅读 · 0 评论 -
LeetCode Array 299 Bulls and Cows
299. Bulls and CowsYou are playing the following Bulls and Cows game with your friend: You write down a number and ask your friend to guess what the number is. Each time your friend makes a guess, yo...原创 2019-11-16 14:51:04 · 74 阅读 · 0 评论 -
LeetCode Array 11 Container With Most Water
11. Container With Most WaterGiven n non-negative integers a1, a2, …, an , where each represents a point at coordinate (i, ai). n vertical lines are drawn such that the two endpoints of line i is at ...原创 2019-11-16 14:40:33 · 75 阅读 · 0 评论 -
LeetCode Array 121 122 Best Time to Buy and Sell Stock I II
Array121. Best Time to Buy and Sell StockSay 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 (i.e.,...原创 2019-11-16 14:43:26 · 66 阅读 · 0 评论 -
LeetCode Array 45 Jump Game II
45. Jump Game IIGiven an array of non-negative integers, you are initially positioned at the first index of the array.Each element in the array represents your maximum jump length at that position....原创 2019-11-16 14:44:18 · 77 阅读 · 0 评论 -
LeetCode Array 55 Jump Game
55. Jump GameGiven an array of non-negative integers, you are initially positioned at the first index of the array.Each element in the array represents your maximum jump length at that position.Det...原创 2019-11-16 14:44:48 · 114 阅读 · 0 评论 -
LeetCode Array 217 219 220 Contains Duplicate I II III
217. Contains DuplicateGiven 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 f...原创 2019-11-16 14:26:40 · 91 阅读 · 0 评论 -
LeetCode Array 123 188 Best Time to Buy and Sell Stock III IV
123. Best Time to Buy and Sell Stock IIISay 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 mos...原创 2019-11-16 14:45:42 · 113 阅读 · 0 评论 -
LeetCode Array 309 Best Time to Buy and Sell Stock with Cooldown
309. Best Time to Buy and Sell Stock with CooldownSay 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 compl...原创 2019-11-16 14:41:20 · 100 阅读 · 0 评论 -
LeetCode Array 118 119 Pascal's Triangle I II
118. Pascal’s TriangleGiven a non-negative integer numRows, generate the first numRows of Pascal’s triangle.In Pascal’s triangle, each number is the sum of the two numbers directly above it.Examp...原创 2019-11-16 14:48:24 · 77 阅读 · 0 评论 -
LeetCode Array 274 275 H-Index I II
274. H-IndexGiven an array of citations (each citation is a non-negative integer) of a researcher, write a function to compute the researcher’s h-index.According to the definition of h-index on Wiki...原创 2019-11-16 14:49:34 · 78 阅读 · 0 评论 -
LeetCode Array 41 First Missing Positive
41. First Missing PositiveGiven an unsorted integer array, find the smallest missing positive integer.Example 1:Input: [1,2,0]Output: 3Example 2:Input: [3,4,-1,1]Output: 2Example 3:Input...原创 2019-11-16 14:52:22 · 54 阅读 · 0 评论 -
LeetCode Array 27 26 80 Remove Element
Array27. Remove ElementGiven an array nums and a value val, 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 ...原创 2019-11-16 14:54:24 · 76 阅读 · 0 评论