← Microsoft questions
CodingMediumReported in a candidate post, Jul 2025

Minimum parentheses to make a string valid

Filed under Microsoft

Given a string s consisting only of the characters '(' and ')', return the minimum number of parentheses (inserted anywhere) needed to make the string valid. A string is valid if every opening…

You've read your 3 free write-ups

Sign up free to keep reading. Your account opens the first 10 questions of every company.

Related Microsoft questions

Collected from public candidate posts and coding forums. Updated Nov 2026.