Help me Solve this problem

Revision en1, by Boring_Day, 2022-09-07 10:12:55

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.

Tags segment tree, dp, greedy, help

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en1 English Boring_Day 2022-09-07 10:12:55 437 Initial revision (published)