Minimum Deletions to Make a Parentheses String Valid

Given a string s containing only '(' and ')', return the minimum number of characters that must be deleted so that the remaining string is a valid parentheses string.

A valid parentheses string...

Example

Unlock to view complete problem details

and practice with sample input/output

Was this article helpful?

View Test Cases & Run Code requires membership

Standard Input
Execution Result: