Sliding Window pattern
Permutation in String
Given two strings s1 and s2, return true if s2 contains a permutation of s1 as a contiguous substring (a window of length |s1| whose character counts match s1). Watch it run step by step, then write your own pseudocode and get it checked by AI.
- LeetCode 567
- Medium
- 1 approach
Sign in with Google or GitHub and you land straight on this page. DSA comes with the all labs plan and every ChaiCode batch.
Sliding WindowLeetCode 567
Medium
The approach
- 01 Fixed-size window · frequency match O(|s1| + |s2|)O(1) space
What you will learn
- How to read Permutation in String and spot the sliding window pattern in it
- Fixed-size window · frequency match: O(|s1| + |s2|) time, O(1) space
- The pseudocode for each approach, its line lit as the animation runs
- Practice: write your own pseudocode and get it checked
More Sliding Window
- Sliding Window MaximumLC 239 · Hard
- OverviewConcept
- Max Sum Subarray of Size KLC 643 · Easy
- Max Sum of Distinct Subarrays, Size KLC 2461 · Medium
- Max Points From CardsLC 1423 · Medium
- Variable-Size WindowConcept
- Longest Substring Without RepeatsLC 3 · Medium
- Longest Repeating Character ReplacementLC 424 · Medium
See Permutation in String run, step by step
Sign in and this page opens on the animation, with all 8 Sliding Window problems beside it.
DSA comes with the all labs plan and every ChaiCode batch.