![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
LeetCode Two Pointers
Haskei
这个作者很懒,什么都没留下…
展开
-
[LeetCode] 644. Maximum Average Subarray II 二分法求平均值
644.Maximum Average Subarray II(题目链接) Hard Given an array consisting ofnintegers, find the contiguous subarray whoselength is greater than or equal tokthat has the maximum average value. And you need to output the maximum average value. Example 1:...原创 2020-08-22 10:38:46 · 289 阅读 · 0 评论 -
[Leetcode] 16. 3Sum Closet 双指针
16.3Sum Closest Given an arraynumsofnintegers and an integertarget, find three integers innumssuch that the sum is closest totarget. Return the sum of the three integers. You may assume that...原创 2020-02-26 08:05:49 · 179 阅读 · 0 评论 -
[Lintcode] 44. Interleaving Positive and Negative Numbers 正负交叉数组
44.Interleaving Positive and Negative Numbers (题目链接) Given an array with positive and negative integers. Re-range it to interleaving with positive and negative integers. Example Example 1 Input : [-1, -2, -3, 4, 5, 6] Outout : [-1, 5, -2, 4, -3, 6] E.原创 2020-08-21 12:08:29 · 194 阅读 · 0 评论 -
[Lintcode] 143. Sort Colors II 双指针
143.Sort Colors II (题目链接) Given an array ofnobjects withkdifferent colors (numbered from 1 to k), sort them so that objects of the same color are adjacent, with the colors in the order 1, 2, ... k. Example Example1 Input: [3,2,2,1,4] 4 Output: ...原创 2020-08-21 11:15:07 · 161 阅读 · 0 评论 -
[Leetcode] 75. Sort Colors 双指针
75.Sort Colors (题目链接) Medium Given an array withnobjects colored red, white or blue, sort themin-placeso that objects of the same color are adjacent, with the colors in the order red, white and blue. Here, we will use the integers 0, 1, and 2 to re...原创 2020-08-21 08:36:09 · 124 阅读 · 0 评论 -
[Lintcode] 49. Sort Letters by Case 分割数组,双指针
49.Sort Letters by Case (题目链接) Given a string which contains only letters. Sort it by lower case first and upper case second. It'sNOTnecessary to keep the original order of lower-case letters and upper case letters. Have you met this question in a...原创 2020-08-21 07:35:09 · 156 阅读 · 1 评论 -
[Leetcode] 283. Move Zeroes 双指针
283.Move Zeroes (题目链接) Easy Given an arraynums, write a function to move all0's to the end of it while maintaining the relative order of the non-zero elements. Example: Input: [0,1,0,3,12] Output: [1,3,12,0,0] Note: You must do thisin-placewith...原创 2020-08-20 10:35:06 · 132 阅读 · 0 评论