
双指针
涛涛酱
北邮研究僧在读
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
【LeetCode 75】 Sort Colors
题目描述Given an array with n objects colored red, white or blue, sort them in-place so 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 represent the color red, white原创 2020-05-24 23:52:07 · 161 阅读 · 0 评论 -
【LeetCode 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.Example:Input: [0,1,0,3,12]Output: [1,3,12,0,0]Note:You must do this in-place without making a copy of the array原创 2020-05-24 23:28:15 · 164 阅读 · 0 评论 -
【LeetCode 209】 Minimum Size Subarray Sum
题目描述Given an array of n positive integers and a positive integer s, find the minimal length of a contiguous subarray of which the sum ≥ s. If there isn’t one, return 0 instead.Example:Input: s = 7, nums = [2,3,1,2,4,3]Output: 2Explanation: the subarra原创 2020-05-13 11:35:04 · 111 阅读 · 0 评论 -
【LeetCode 239】 Sliding Window Maximum
题目描述Given an array nums, there is a sliding window of size k which is moving from the very left of the array to the very right. You can only see the k numbers in the window. Each time the sliding window moves right by one position. Return the max sliding原创 2020-05-12 20:26:55 · 124 阅读 · 0 评论 -
【LeetCode 75】Sort Colors
题意Given an array with n objects colored red, white or blue, sort them in-place so that objects of the same color are adjacent, with the colors in the order red, white and blue.Here, we will use the ...原创 2020-01-31 13:51:59 · 104 阅读 · 0 评论