Remove Unmatched Brackets

Asked at Meta · Coding Questions · Difficulty: Hard

A string contains lowercase letters and brackets. Remove as few brackets as possible so that the brackets left over are balanced, and return the resulting string. Letters are never removed.

Loading the problem…