NeetCode #796LC-2116MediumGreedy
← Back to All Problems#796 · #2116 · Check if a Parentheses String Can Be Valid(判断一个括号字符串是否有效)
📌 Problem Statement & Constraints
You are given a string
s of ( and ), and a binary string locked where 1 means the character is locked (unchangeable) and 0 means it may be flipped. Return true if s can be turned into a valid parentheses string. Constraints: 1 <= s.length <= 10^5, locked.length == s.length, s[i] is ( or ), locked[i] is 0 or 1.🔒
Sign In to Unlock Full Solutions for All 973 Problems
Sign in to access step-by-step logic, benchmark Python3 code, complexity breakdown, and offline export!