原文链接: https://leetcode-cn.com/problems/longest-substring-without-repeating-characters 英文原文Given a string s, find the length of the longest substring without repeating characters. Example 1: Input: s = "abcabcbb" Output: 3 Explanation: The answer is "…
标签详情
滑动窗口 分类
原文链接: https://leetcode-cn.com/problems/substring-with-concatenation-of-all-words 英文原文You are given a string s and an array of strings words of the same length. Return all starting indices of substring(s) in s that is a concatenation of each word in w…
原文链接: https://leetcode-cn.com/problems/minimum-window-substring 英文原文Given two strings s and t of lengths m and n respectively, return the minimum window substring of s such that every character in t (including duplicates) is included in the window. I…
原文链接: https://leetcode-cn.com/problems/repeated-dna-sequences 英文原文The DNA sequence is composed of a series of nucleotides abbreviated as 'A', 'C', 'G', and 'T'. For example, "ACGAATTCCG" is a DNA sequence. When studying DNA, it is useful to identify …
原文链接: https://leetcode-cn.com/problems/minimum-size-subarray-sum 英文原文Given an array of positive integers nums and a positive integer target, return the minimal length of a contiguous subarray [numsl, numsl+1, ..., numsr-1, numsr] of which the sum is …
原文链接: https://leetcode-cn.com/problems/contains-duplicate-ii 英文原文Given an integer array nums and an integer k, return true if there are two distinct indices i and j in the array such that nums[i] == nums[j] and abs(i - j) <= k. Example 1: Input: nums…
原文链接: https://leetcode-cn.com/problems/contains-duplicate-iii 英文原文Given 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. Exam…
原文链接: https://leetcode-cn.com/problems/sliding-window-maximum 英文原文You 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 wi…
原文链接: https://leetcode-cn.com/problems/longest-substring-with-at-least-k-repeating-characters 英文原文Given a string s and an integer k, return the length of the longest substring of s such that the frequency of each character in this substring is greate…
原文链接: https://leetcode-cn.com/problems/find-all-anagrams-in-a-string 英文原文Given two strings s and p, return an array of all the start indices of p's anagrams in s. You may return the answer in any order. An Anagram is a word or phrase formed by rearra…
原文链接: https://leetcode-cn.com/problems/sliding-window-median 英文原文The median 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 values. For examples, i…
原文链接: https://leetcode-cn.com/problems/permutation-in-string 英文原文Given two strings s1 and s2, return true if s2 contains a permutation of s1, or false otherwise. In other words, return true if one of s1's permutations is the substring of s2. Example …
原文链接: https://leetcode-cn.com/problems/smallest-range-covering-elements-from-k-lists 英文原文You have k lists of sorted integers in non-decreasing order. Find the smallest range that includes at least one number from each of the k lists. We define the ra…
原文链接: https://leetcode-cn.com/problems/maximum-average-subarray-i 英文原文You are given an integer array nums consisting of n elements, and an integer k. Find a contiguous subarray whose length is equal to k that has the maximum average value and return …
原文链接: https://leetcode-cn.com/problems/subarray-product-less-than-k 英文原文Given an array of integers nums and an integer k, return the number of contiguous subarrays where the product of all the elements in the subarray is strictly less than k. Example…
原文链接: https://leetcode-cn.com/problems/maximum-length-of-repeated-subarray 英文原文Given two integer arrays nums1 and nums2, return the maximum length of a subarray that appears in both arrays. Example 1: Input: nums1 = [1,2,3,2,1], nums2 = [3,2,1,4,7] O…
原文链接: https://leetcode-cn.com/problems/new-21-game 英文原文Alice plays the following game, loosely based on the card game "21". Alice starts with 0 points and draws numbers while she has less than k points. During each draw, she gains an integer number o…
原文链接: https://leetcode-cn.com/problems/shortest-subarray-with-sum-at-least-k 英文原文Given an integer array nums and an integer k, return the length of the shortest non-empty subarray of nums with a sum of at least k. If there is no such subarray, return…
原文链接: https://leetcode-cn.com/problems/fruit-into-baskets 英文原文You are visiting a farm that has a single row of fruit trees arranged from left to right. The trees are represented by an integer array fruits where fruits[i] is the type of fruit the ith …
原文链接: https://leetcode-cn.com/problems/binary-subarrays-with-sum 英文原文Given a binary array nums and an integer goal, return the number of non-empty subarrays with a sum goal. A subarray is a contiguous part of the array. Example 1: Input: nums = [1,0,…
原文链接: https://leetcode-cn.com/problems/longest-turbulent-subarray 英文原文Given an integer array arr, return the length of a maximum size turbulent subarray of arr. A subarray is turbulent if the comparison sign flips between each adjacent pair of elemen…
原文链接: https://leetcode-cn.com/problems/subarrays-with-k-different-integers 英文原文Given an integer array nums and an integer k, return the number of good subarrays of nums. A good array is an array where the number of different integers in that array is…
原文链接: https://leetcode-cn.com/problems/minimum-number-of-k-consecutive-bit-flips 英文原文You are given a binary array nums and an integer k. A k-bit flip is choosing a subarray of length k from nums and simultaneously changing every 0 in the subarray to …
原文链接: https://leetcode-cn.com/problems/max-consecutive-ones-iii 英文原文Given a binary array nums and an integer k, return the maximum number of consecutive 1's in the array if you can flip at most k 0's. Example 1: Input: nums = [1,1,1,0,0,0,1,1,1,1,0],…
原文链接: https://leetcode-cn.com/problems/maximum-sum-of-two-non-overlapping-subarrays 英文原文Given an integer array nums and two integers firstLen and secondLen, return the maximum sum of elements in two non-overlapping subarrays with lengths firstLen and…
原文链接: https://leetcode-cn.com/problems/longest-duplicate-substring 英文原文Given a string s, consider all duplicated substrings: (contiguous) substrings of s that occur 2 or more times. The occurrences may overlap. Return any duplicated substring that ha…
原文链接: https://leetcode-cn.com/problems/grumpy-bookstore-owner 英文原文There is a bookstore owner that has a store open for n minutes. Every minute, some number of customers enter the store. You are given an integer array customers of length n where custo…
原文链接: https://leetcode-cn.com/problems/distinct-echo-substrings 英文原文Return the number of distinct non-empty substrings of text that can be written as the concatenation of some string with itself (i.e. it can be written as a + a where a is some string…
原文链接: https://leetcode-cn.com/problems/swap-for-longest-repeated-character-substring 英文原文You are given a string text. You can swap two of the characters in the text. Return the length of the longest substring with repeated characters. Example 1: Inpu…
原文链接: https://leetcode-cn.com/problems/constrained-subsequence-sum 英文原文Given an integer array nums and an integer k, return the maximum sum of a non-empty subsequence of that array such that for every two consecutive integers in the subsequence, nums…
1 / 2