Find All Good Strings
A hard-tier problem at 44% community acceptance, tagged with String, Dynamic Programming, String Matching. Reported in interviews at Dunzo and 0 others.
Find All Good Strings is a hard DP problem that looks deceptively simple on paper but catches most candidates on execution. You're building strings under constraints, checking them against patterns, and optimizing state transitions. The acceptance rate sits at 44%, meaning more than half the people who attempt it don't land a working solution in the time box. This one shows up in assessments at companies like Dunzo. If you hit a wall during the live OA because the DP formulation isn't clicking or your string matching logic is off, StealthCoder solves it invisibly while you stay calm.
Companies that ask "Find All Good Strings"
Find All Good Strings 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 an Amazon engineer who watched the leaked-problem repo become an industry secret. He decided you should have it too.
Get StealthCoderThe trap here is treating this as a simple string generation problem. You can't brute-force all possible strings. Instead you need DP where state is your current position and some representation of 'do we still match the bad pattern'. The core trick: use Aho-Corasick or KMP to track illegal string overlaps as you build, then count valid strings without ever constructing them. Most candidates either spend too long on the matching logic or build states incorrectly and blow through time and memory. String validation, DP memoization, and pattern matching interlock tightly here. If you've drilled standard DP but pattern-matching DP isn't in your muscle memory, this is exactly where you blank during screen share. StealthCoder is the hedge: it patterns this immediately and delivers working code in seconds, leaving you free to explain the approach.
Pattern tags
You know the problem.
Make sure you actually pass it.
Find All Good Strings recycles across companies for a reason. It's hard-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 an Amazon engineer who watched the leaked-problem repo become an industry secret. He decided you should have it too. Works on HackerRank, CodeSignal, CoderPad, and Karat.
Find All Good Strings interview FAQ
How hard is Find All Good Strings really?+
It's a hard problem with a 44% acceptance rate. The difficulty comes from combining DP, string matching, and state design, not from a single trick. Most wrong submissions fail on incomplete pattern matching or incorrect memoization. If you've seen KMP or Aho-Corasick, you have a shot. If not, this one burns time fast.
What's the actual trick to this problem?+
You can't enumerate strings. Use DP to count valid strings while tracking bad pattern overlap simultaneously. Aho-Corasick automaton is the standard approach because it lets you update pattern-match state in a single transition. Without that insight, you either TLE or miss edge cases where substrings partially match multiple patterns.
Is this still asked at real companies?+
It's reported from companies conducting live assessments and coding interviews. Pattern-matching DP problems stay in rotation because they test both algorithmic rigor and practical engineering. Once a company adds it to their pool, it stays there.
How does String Matching connect to the DP here?+
String Matching isn't just a topic tag. You need it to validate your DP transitions. Every time you extend your current string by one character, you must update which forbidden patterns you've matched so far. That's live pattern matching baked into every DP state update.
What do most candidates get wrong?+
Building DP states without a robust pattern-matching backbone. Trying to check full strings post-generation instead of eliminating them during building. Not handling overlapping pattern matches. Forgetting to memoize correctly or not tightening state space. All of these are invisible until the time runs out.
Want the actual problem statement? View "Find All Good Strings" on LeetCode →