Your question is Check Balanced Parentheses. Start with the requirements on the right.
Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.
Glean query text can contain parentheses to group search conditions. Implement is_balanced(s) to determine whether every opening parenthesis has a matching closing parenthesis in the correct order.
Only the characters ( and ) affect balance. Any other characters, including letters, spaces, punctuation, and operators, must be ignored.
Given a string s, return a Boolean:
True if the parentheses are balanced.False if a closing parenthesis appears without a matching opening parenthesis, an opening parenthesis remains unmatched, or the nesting order is invalid.def is_balanced(s):