Remove Invalid Parentheses

Hard · Backtracking · about 35 minutes

Asked at Meta, Google, Amazon, ByteDance, Uber.

Given a string s of parentheses and lowercase letters, remove the minimum number of parentheses to make it valid. Return every unique valid string you can get with that minimum number of removals, in any order.

Related guides