I was solving yesterday's c with a different approach. To solve it with my technique what i need to know is:
Let's say we have a string 's' of length 'n' with parenthesis ('(' or ')') and we have queries with 'L' and 'R' (1<=L<=R<=N).
we need to tell whether the substring from L to R is balanced or not.
Is there any way to solve the queries in constant time or lets say log(n) time?
Please Help.