Stacks | CodeChef

i have wrote the brute force but not able to optimize it. Need help

https://www.codechef.com/viewsolution/33056142
Commented code. I hope you know basic C++ STL.

1 Like

thanks got it using binary searh