Reported interview periodApr 2026
Fewest inserts to balance brackets
Report how many bracket characters must be inserted anywhere in a parenthesis string to make every prefix and the whole line balanced.
Practice focusRequirements - The input is one line containing only ( and ) . - A string is balanced when every prefix has at least as many ( as ) , and the total counts are equal. - Insertions may be placed at any position. Removing, replacing, or reordering characters is not allowed. - Return the minimum number of inserted characters as a decimal string. - A line that is already balanced returns "0" . - run case(case: dict) forwards case["stdin"] to solve . - Do not append a trailing newline to the returned string; return the value exactly once.