Painter Problem

is something wrong with the code?


its not passing all test cases

Just a minor mistake in instantiating the start of the point for the binary search
c = a[0];
for(int i = 0 ; i < n ; i++){
c = max( c, a[i]);
}
instead of taking max u have been comparing with 1st value of index;

If u got ur doubt solved mark it resolved from ur end.

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.