Check Balanced Paranthesis (Problem 2) - InfyTQ Solution in Python
Check Balanced Paranthesis (Problem 2)
InfyTQ Solution in Python
PROBLEM STATEMENT
Write a python function which accepts a string containing a pattern of brackets and returns true if the pattern of brackets is correct. Otherwise it returns false.
The string of brackets is correct if it satisfies the following conditions:
1. Number of opening and closing brackets are equal.
2. Pattern should not start with closing bracket and end with opening bracket.
Sample Input | Expected Output |
---|---|
)()((()()) | False |
()((())()) | True |
() | True |
SOLUTION
SHARE
If you find this useful, please share with your friends and Community.
CODE TOGETHER..GROW TOGETHER.
CODE TOGETHER..GROW TOGETHER.
Newer Posts
Newer Posts
Older Posts
Older Posts
Comments