Permutation in String

Read the lesson → understand the pattern → then code. Tutor works offline (built-in teacher); optional Cursor/Gemini keys upgrade chat quality.

Topic refresher: Sliding Window — Live Range

Maintain [L,R] that satisfies a constraint; answer from length/sum/counts.

int L = 0;
for (int R = 0; R < n; R++) {
    // add s[R]
    while (/* invalid */) { /* remove s[L] */ L++; }
    // update answer
}
Sliding Window

Permutation in String

Medium
LeetCode
4/6
MediumSliding WindowLeetCode #567

Permutation in String

Fixed window of len(s1). Compare frequency maps / matches count.

Examples

Example 1

Input

ab eidbaooo

Output

true
Example 2

Input

ab eidboaoo

Output

false

Stuck? Take a nudge

C++17