Valid Parentheses
A easy-tier problem at 42% community acceptance, tagged with String, Stack. Reported in interviews at Bank of America and 93 others.
Valid Parentheses hits 94 companies hard, from Bank of America to Braze to Dell. It's marked easy, so the bar for a clean solution is high. That said, the acceptance rate sits at 42%, meaning nearly 6 in 10 candidates either blank on the stack pattern or fumble the edge cases during the live OA. This is the one problem that looks trivial but separates people who've actually coded from people who've only read about it. If you hit it cold and your brain locks, StealthCoder runs invisibly and surfaces a working solution in seconds.
Companies that ask "Valid Parentheses"
Valid Parentheses 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. Built by a senior engineer who knows the OA is theater. This is the script.
Get StealthCoderThe trick is recognizing that you need a stack, not regex or string replacement. Push opening brackets, pop on closing brackets, and verify the pair matches. Candidates usually get the happy path right but crater on edge cases: empty strings, unmatched closers, mismatched pairs. The naive approach of replacing substring pairs recursively is slow and wrong. The stack approach is O(n) time and O(n) space, linear and clean. Most people who fail this problem either skip the stack entirely or don't validate that the stack is empty at the end. During a live assessment, if you blank on why a stack matters here, StealthCoder gives you a working implementation so you move on and bank points elsewhere.
Pattern tags
You know the problem.
Make sure you actually pass it.
Valid Parentheses recycles across companies for a reason. It's easy-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. Built by a senior engineer who knows the OA is theater. This is the script. Works on HackerRank, CodeSignal, CoderPad, and Karat.
Valid Parentheses interview FAQ
Why is the acceptance rate only 42% if this is an easy problem?+
Easy rating refers to solution simplicity, not how often people solve it correctly live. Under time pressure in an OA, candidates skip the stack pattern and try string replacement, or forget to check if the stack is empty at the end. Edge cases punish you hard. The problem is easy only if you've drilled the pattern.
Do I really need a stack, or can I use a counter?+
You need a stack because you're matching pairs, not just counting. A counter fails on mixed types like '({})' versus '({)]'. The stack tracks which bracket opened and ensures the closer matches it. Counters only work for a single bracket type.
Is this still asked at companies like Bank of America and Dell?+
Yes. Valid Parentheses appears across 94 companies in recent hiring data, including Bank of America, Dell, and FreshWorks. It's a warm-up or screen filter. You're expected to solve it in under 5 minutes without hints. Flubbing it signals you haven't practiced fundamentals.
What are the edge cases I need to handle?+
Empty string passes. Single bracket fails. String with only closers fails. String with only openers fails. Mismatched pairs like '(]' fail. Stack must be empty after processing all characters. A clean solution checks all four before returning true.
How does Valid Parentheses relate to the Stack topic?+
It's the canonical stack problem. Stack is LIFO, and parentheses matching is inherently LIFO. You push openers and pop closers. Understanding why stack is right here teaches you when to reach for a stack in harder problems like daily temperatures or trapping rain water.
Want the actual problem statement? View "Valid Parentheses" on LeetCode →