Balanced Parathesis

4.7

3 votes
Easy
Problem

Given a string containing parentheses. You have to check if the parenthesis is balanced or not.

If it is balanced print “Yes”,else “No”.

Constraint:

0 < |s| <= 109

Input:

( ( ( ) )

Output:

No

Input:

( ( ( ) ) )

Output:

Yes

Time Limit: 0.5
Memory Limit: 256
Source Limit:
Editor Image

?