Removing Parentheses
https://binarysearch.com/problems/Removing-Parentheses
I know it's not Leetcode please don't kill me. I was in a competition and I thought this was neat. Couldn't find the leetcode alternative.
Given a string of parentheses s
, return the minimum number of parentheses to be removed to make the string valid (i.e. each open parenthesis is eventually closed).
For example, given the string "()())()"
, you should return 1. Given the string ")("
, you should return 2, since we must remove all of them.
Last updated