Algorithm · Meta · Medium
1) Make parentheses string valid with minimal deletions Approach The goal is to keep every lowercase letter because letters never make parentheses invalid. The only characters that may need removal are unmatched parentheses. Use a stack of indices: Scan s from left to right. When you see '(', push its index onto the stack. When you see ')': If the stack is non-empty, pop one index. That index represents a matching opening parenthesis. If the stack is empty, this ')' has no…
Checking your access…