Determine if a string of parentheses is valid
Anonymous
Use a counter and increase by 1 for every opening parenthesis and decrease by 1 for every closing parenthesis. If counter ever reaches -1, return False (not valid) and the counter at the end of the string is not 0, return False, else return True.
Check out your Company Bowl for anonymous work chats.