String
301. Remove Invalid Parentheses
The number of characters you have to delete is not something the search discovers, it is known before the search starts. One left-to-right pass counts the ) that arrive with nothing open and the ( left dangling at the end; those two numbers, rmL and rmR, are the exact budget, and every valid answer
Loading…