Implementing the prob

sir/mam…do I need to solve this problem using binary search?

hello @kodivine0
No ,
this problem is solved with help of partial prefix and partial suffix sum.

image

sir, I have implemented it as you have told me but still I’m facing difficulties.

share ur code using cb ide.
i will check

how to do that, do I need to share the link?

paste ur code here -> https://ide.codingblocks.com/
press save button.
share the generated link

sir, have u checked my code?

yeah,
image

use >=
do similar change in second loop as well

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.

there is still doubt sir, the test cases are not getting passed.

have u done the changes that i suggested

check ur corrected code here->

hi @kodivine0, you can check the code provided by aman ,
in case of any doubt feel free to ask here

thank you sir, I got my answer.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.