Search
⌘K

Leetcode 567. Permutation in String

Check whether any substring of s2 of length |s1| is a permutation of s1 (i.e., has the same character multiset). The core challenge is to do this efficiently—typically via a sliding-window with constant-size (26-letter) frequency comparisons for strings up to length 10^4.

Asked at:

Apple


Question Timeline

See when this question was last asked and where, including any notes left by other candidates.

Mid March, 2026

Apple

Senior

Given two strings `input` and `pattern`, return `true` if `pattern` contains a permutation of `input` as a substring. In other words, return true if any anagram of `input` appears as a contiguous substring in `pattern`.

Your account is free and you can post anonymously if you choose.