Interview questions
Find a company or topic. Read the sources, then practice.
Loading the question library…
Find a company or topic. Read the sources, then practice.
Loading the question library…
Showing 1–8
Check whether a string of parentheses/brackets is valid by ensuring every closing bracket matches the most recent unmatched opening bracket and the types and nesting…
Companies: Amazon, Apple, Bloomberg, Google +9
Bracket Sequences · Stack · String
Last reported Aug 2026
Determine whether a string containing '(', ')', and '*' (where '*' can represent '(', ')', or empty) can be assigned so the parentheses are balanced…
Companies: Apple, Microsoft, Oracle
Bracket Sequences · Dynamic Programming · Greedy · Stack
Last reported Jul 2026
Given a number n, generate all distinct well-formed parentheses strings formed from n pairs of opening and closing brackets. Return all valid combinations as a…
Companies: Amazon, Bloomberg, Microsoft, Salesforce
Backtracking · Bracket Sequences · Dynamic Programming · String
Last reported Apr 2026
Find the length of the longest well-formed (balanced) parentheses substring in a string of '(' and ')', handling nested and adjacent valid segments; this typically…
Companies: Amazon, Meta, Microsoft, Uber
Bracket Sequences · Dynamic Programming · Stack · String
Last reported Apr 2026
Given a valid parentheses string, compute its maximum nesting depth — the largest number of parentheses that are open at the same time. (Equivalent to…
Companies: Meta, Rippling
Bracket Sequences · Stack · String
Last reported Feb 2026
Given a string of '(' and ')', return the minimum number of parentheses insertions needed to make the string valid. This is solved greedily by…
Companies: Meta, Microsoft
Bracket Sequences · Greedy · Stack · String
Last reported Dec 2025
Given a string of '(' and ')', return the minimum number of insertions needed to make it balanced under the rule that each '(' must…
Companies: Bloomberg, Meta
Bracket Sequences · Greedy · Stack · String
Last reported Mar 2025
Given a valid parentheses string, assign each character to one of two disjoint valid-parentheses subsequences A and B (output 0/1 per index) so that the…
Companies: Microsoft
Bracket Sequences · Stack · String