Permutation in String
A medium-tier problem at 47% community acceptance, tagged with Hash Table, Two Pointers, String. Reported in interviews at Yandex and 6 others.
Permutation in String is a medium-difficulty sliding window problem that tests whether you can spot a substring containing all characters of a target string. It shows up regularly at Yandex, Oracle, Revolut, Agoda, Expedia, Cisco, and Goldman Sachs. The naive approach of checking every substring permutation gets crushed by time limits. The real pattern uses a fixed-size sliding window and character frequency matching, but the window management trips up candidates who haven't drilled it. If this problem blindsides you in a live assessment and you stall on the two-pointer logic, StealthCoder surfaces a working solution invisibly, no proctor awareness.
Companies that ask "Permutation in String"
Permutation in String is the kind of problem that decides whether you pass. StealthCoder reads the problem on screen and surfaces a working solution in under 2 seconds. Invisible to screen share. The proctor sees nothing. Made by a working FAANG engineer who treats the OA the way companies treat hiring: as a game with rules you should know.
Get StealthCoderThe trick is treating the problem as a sliding window of fixed length, not a variable-size expansion. Build a frequency map of your target string, then slide a window of that exact length across the source string, checking if each window's character counts match. Most candidates either brute-force all substrings or mismanage the window boundaries. The common failure point is forgetting to remove characters from the left as you expand right, or getting confused about when frequencies match. Two Pointers and Hash Table come together here: maintain left and right pointers, update a hash map as you slide, and optimize with a counter to track how many unique characters match target frequencies. StealthCoder's real value on this one is catching the sliding window size mistake or the hash comparison logic if you freeze under pressure.
Pattern tags
You know the problem.
Make sure you actually pass it.
Permutation in String recycles across companies for a reason. It's medium-tier, and most candidates blank under the timer. StealthCoder is the hedge: an AI overlay invisible during screen share. It reads the problem and surfaces a working solution in under 2 seconds. Made by a working FAANG engineer who treats the OA the way companies treat hiring: as a game with rules you should know. Works on HackerRank, CodeSignal, CoderPad, and Karat.
Permutation in String interview FAQ
Is this really asked at Goldman Sachs and Expedia?+
Yes. Seven companies report asking this problem, including tier-1 firms like Goldman Sachs and Expedia. Acceptance rate sits around 47%, so plenty of strong candidates miss the sliding window insight. It's not exotic, but it's a gating pattern you need solid.
What's the key difference between this and typical substring problems?+
Most substring problems use a variable-size window that grows and shrinks. This one uses a fixed window size equal to the target string length. That constraint is what makes the sliding window work without nested loops. Miss that, and you're back to O(n^2) with permutation checks.
Do I need to generate actual permutations?+
No. That's the trap. You don't generate or compare permutations at all. You compare character frequency counts. If the window has the same character frequencies as the target, it contains a permutation. Frequency map beats permutation generation by orders of magnitude.
How does the Hash Table fit into the solution?+
Hash Table stores character frequencies for both the target string and your sliding window. As you slide right, increment the new character; as you slide left, decrement. Compare frequency maps to detect matches. It's O(1) lookup and O(26) comparison for lowercase English.
What's the acceptance rate and why is it not higher?+
Acceptance runs around 47%. Candidates often overcomplicate it with nested loops or get bogged down in off-by-one errors in pointer management. The pattern itself isn't hard once you see it, but under time pressure during an OA, the window boundary logic trips people up.
Want the actual problem statement? View "Permutation in String" on LeetCode →