Tag: sliding window algorithm
Given a string s , find the length of the longest substring t that contains at most 2 distinct characters. Example 1: Input: “eceba” Output: 3 Explanation: t is …
Given a string, find the length of the longest substring T that contains at most k distinct characters. Example 1: Input: s = “eceba”, k = 2 Output: 3 …
Given a string S, return the number of substrings of length K with no repeated characters. Example 1: Input: S = “havefunonleetcode”, K = 5 Output: 6 Explanation: There …
Given an array A of integers and integer K, return the maximum S such that there exists i < j with A + A = S and S < …
Given a string s and a non-empty string p, find all the start indices of p’s anagrams in s. Strings consists of lowercase English letters only and the length …