Practice · 6 problems
Sliding Window
0 of 6 solved on this device
- 011Best Time to Buy and Sell StockYou are given an array `prices` where `prices[i]` is the price of a stock on day `i`. Choose one day to buy and a later day to sell to maximise profit. Return the maximum profit, or 0 if no profit is possible.Easy
- 012Longest Substring Without Repeating CharactersGiven a string `s`, find the length of the longest substring that contains no repeating characters.Medium
- 013Minimum Window SubstringGiven strings `s` and `t`, return the shortest substring of `s` that contains every character of `t` including duplicates. If no such window exists, return "". The answer is guaranteed to be unique.Hard
- 057Longest Repeating Character ReplacementGiven a string `s` of uppercase English letters and an integer `k`, you may change at most `k` characters to any other uppercase letter. Return the length of the longest substring containing a single repeated letter.Medium
- 058Permutation in StringGiven two strings `s1` and `s2`, return true if `s2` contains a permutation of `s1` as a contiguous substring.Medium
- 059Sliding Window MaximumGiven an array `nums` and a window size `k`, the window slides one position at a time from left to right. Return an array of the maximum in each window position.Hard