Given a string S , of length N (contains parenthesis ) , and Q queries, in each query L and R be two indexes of string find the length of the longest balanced substring between L to R.
(Actually, you have tagged a noob between legends…XD) btw can you give me little insights about how you solved this cf problem, I mean just give hints, phle khud try krna hai, editorial baad me dekhunga
No, assume S = )())(, F(0) = -1, F(1) = 0, F(2) = -1, F(3) = -2, F(4) = -1, again F(0) = F(4) but (0, 4] is not balanced.
Next time, come with a mathematical proof of what you say.