Math, asked by nitu25768, 4 months ago

Find the irror ramu calculated the ixp ression -7-(-3) and came up with an answer -10-what did ramu do wrong ?​

Answers

Answered by Rivan2010
0

Answer:

The idea is take value of open bracket ‘(‘ as 1 and value of close bracket ‘)’ as -1. Now start finding the prefix sum of the given string. The farthest index, say maxi, where the value of sum is 0 is the index upto which longest balanced prefix exists. So the answer would be maxi + 1.

Below is the implementation of this approach:

Similar questions