leetcode滑动窗口
文章平均质量分 65
Bryan要加油
这个作者很懒,什么都没留下…
展开
-
220. Contains Duplicate III(Leetcode每日一题-2021.04.17)--抄答案
ProblemGiven an integer array nums and two integers k and t, return true if there are two distinct indices i and j in the array such that abs(nums[i] - nums[j]) <= t and abs(i - j) <= k.Constraints:0 <= nums.length <= 2 * 10^4-2^31 <= n原创 2021-04-17 08:07:48 · 357 阅读 · 0 评论 -
1052. Grumpy Bookstore Owner(Leetcode每日一题-2021.02.23)
ProblemToday, the bookstore owner has a store open for customers.length minutes. Every minute, some number of customers (customers[i]) enter the store, and all those customers leave after the end of that minute.On some minutes, the bookstore owner is gr原创 2021-02-23 20:10:24 · 215 阅读 · 0 评论 -
1438. Longest Continuous Subarray With Absolute Diff Less Than or Equal (Leetcode每日一题-2021.02.21)
ProblemGiven an array of integers nums and an integer limit, return the size of the longest non-empty subarray such that the absolute difference between any two elements of this subarray is less than or equal to limit.Constraints:1 <= nums.length &l原创 2021-02-21 20:41:20 · 190 阅读 · 0 评论 -
567. Permutation in String(Leetcode每日一题-2021.02.10)
ProblemGiven two strings s1 and s2, write a function to return true if s2 contains the permutation of s1. In other words, one of the first string’s permutations is the substring of the second string.Constraints:The input strings only contain lower case原创 2021-02-10 19:48:38 · 126 阅读 · 0 评论 -
992. Subarrays with K Different Integers(Leetcode每日一题-2021.02.09)--抄答案
ProblemGiven an array A of positive integers, call a (contiguous, not necessarily distinct) subarray of A good if the number of different integers in that subarray is exactly K.(For example, [1,2,3,1,2] has 3 different integers: 1, 2, and 3.)Return the原创 2021-02-09 22:41:53 · 178 阅读 · 1 评论 -
1423. Maximum Points You Can Obtain from Cards(Leetcode每日一题-2021.02.06)
ProblemThere are several cards arranged in a row, and each card has an associated number of points The points are given in the integer array cardPoints.In one step, you can take one card from the beginning or from the end of the row. You have to take exa原创 2021-02-06 20:19:41 · 219 阅读 · 0 评论 -
1208. Get Equal Substrings Within Budget(Leetcode每日一题-2021.02.05)
ProblemYou are given two strings s and t of the same length. You want to change s to t. Changing the i-th character of s to i-th character of t costs |s[i] - t[i]| that is, the absolute difference between the ASCII values of the characters.You are also g原创 2021-02-05 19:22:25 · 130 阅读 · 0 评论 -
480. Sliding Window Median(Leetcode每日一题-2021.02.03)--抄答案
ProblemMedian is the middle value in an ordered integer list. If the size of the list is even, there is no middle value. So the median is the mean of the two middle value.Examples:[2,3,4] , the median is 3[2,3], the median is (2 + 3) / 2 = 2.5Given an原创 2021-02-03 19:32:53 · 191 阅读 · 0 评论 -
239. Sliding Window Maximum(Leetcode每日一题-2021.01.02)--抄答案
ProblemYou are given an array of integers 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.原创 2021-01-02 17:29:19 · 178 阅读 · 0 评论 -
209. Minimum Size Subarray Sum(Leetcode每日一题-2020.06.28)
ProblemGiven 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.ExampleInput: s = 7, nums = [2,3,1,2,4,3]Output: 2Explanation: the suba原创 2020-06-28 11:14:05 · 210 阅读 · 0 评论 -
76. Minimum Window Substring(Leetcode每日一题-2020.05.23)
ProblemGiven a string S and a string T, find the minimum window in S which will contain all the characters in T in complexity O(n).ExampleInput: S = “ADOBECODEBANC”, T = “ABC”Output: “BANC”NoteIf there is no such window in S that covers all charac原创 2020-05-24 22:55:25 · 164 阅读 · 0 评论 -
3. Longest Substring Without Repeating Characters(Leetcode每日一题-2020.05.02)
ProblemGiven a string, find the length of the longest substring without repeating characters.Example1Input: “abcabcbb”Output: 3Explanation: The answer is “abc”, with the length of 3.Example2...原创 2020-05-02 21:55:12 · 210 阅读 · 0 评论