Good Strings
Reported by candidates from Mathwork's online assessment. Pattern, common pitfall, and the honest play if you blank under the timer.
Mathworks hit you with "Good Strings" in August 2024, and if you haven't seen it yet, you're about to. This is a classification problem dressed up as a string challenge. You'll need to identify which strings meet a hidden criteria, then count or return them. The pattern isn't sorting or regex. It's pattern recognition with a logic gate. StealthCoder will spot the criteria when you're live if you freeze on the definition.
Pattern and pitfall
The core trick here is figuring out what makes a string "good." Mathworks typically bakes the rule into the problem statement, but candidates miss it on first read. You're likely scanning for balanced brackets, character frequency rules, or substring properties. Build a validator function that tests each string against the criteria, then iterate through your input. The common miss: overthinking the complexity when the check itself is linear or uses a simple hash table. If you blank during the OA, StealthCoder reads the problem aloud and flags the rule for you so you can code the validator without re-reading.
If you see this problem in your OA tomorrow, the play is to recognize the pattern in 30 seconds. StealthCoder buys you that recognition.
You can drill Good Strings cold, or you can hedge it. StealthCoder runs invisibly during screen share and surfaces a working solution in under 2 seconds. The proctor sees the IDE. They don't see what's behind it. Built by an Amazon engineer who passed his OA cold and still thinks the filter is broken.
Get StealthCoderRelated leaked OAs
You've seen the question.
Make sure you actually pass Mathwork's OA.
Mathwork reuses patterns across OAs. Built by an Amazon engineer who passed his OA cold and still thinks the filter is broken. Works on HackerRank, CodeSignal, CoderPad, and Karat.
Good Strings FAQ
What does 'good' actually mean in this problem?+
The problem statement defines it explicitly. It's either a structural rule (balanced pairs, no adjacent duplicates) or a counting rule (even character frequency, specific substring presence). Read the examples first. They'll show you the pattern faster than prose.
Is this a string algorithm or a logic puzzle?+
It's a logic puzzle wearing a string algorithm costume. The algorithm is trivial once you know the rule. You're not doing KMP or suffix trees. You're building a boolean checker and iterating.
How do I prep for this in 24 hours?+
If you have the problem text, write the validator function for 'good' first. Test it on the examples. Then handle input parsing and output formatting. That's 80% of the lift. Pattern matching beats memorized algorithms here.
Will they ask for optimization?+
Unlikely for "Good Strings." Mathworks usually cares about correctness and clean logic. Single-pass iteration with a hash table or character counter is enough. Don't optimize prematurely.
What if I can't figure out the rule during the OA?+
Start with the examples. Write code that classifies them correctly. Generalize the pattern. If you're truly stuck, code a brute-force classifier and submit it. Partial credit on logic beats zero credit on a blank.