Painter's Partition - 2 test cases failing (Java)

Hi, 2 test cases are failing. Please help

I’m using Java

@Anshul-Chauhan-10221922864290257

take s as
for(int i = 0 ; i < n ; i++)
s = max( s ,a[i]) ;

and declare m = (s + e) / 2;
in line 21 before calling isvalid

ah, stupid mistake. Wrong bound for search space.

Thanks @aa1

1 Like