Tap here to switch tabs
Problem
Submissions

Problem: Minimum Add to Make Parentheses Valid

med
30 min
Try to solve the Minimum Add to Make Parentheses Valid problem.

Statement

Given a string s consisting only of the characters '(' and ')', determine the minimum number of parentheses you must add to s so that the resulting string is a valid parentheses string.

A valid parentheses string is one where parentheses are properly matched and correctly nested.

Constraints:

  • 1≤1 \leq s.length ≤1000\leq 1000

  • s[i] is either '(' or ')'

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Minimum Add to Make Parentheses Valid

med
30 min
Try to solve the Minimum Add to Make Parentheses Valid problem.

Statement

Given a string s consisting only of the characters '(' and ')', determine the minimum number of parentheses you must add to s so that the resulting string is a valid parentheses string.

A valid parentheses string is one where parentheses are properly matched and correctly nested.

Constraints:

  • 1≤1 \leq s.length ≤1000\leq 1000

  • s[i] is either '(' or ')'