this doesn’t pass all test cases. please tell my mistake.
Painters partition problem binary search approach
- You have created your array of size K, which is the number of painters and not the the number of boards. Correct that.
- Make the array of type ‘long’ instead of ‘int’ because each board’s length can be <= 10^8, and the sum could exceed the size of ‘int’. You will have to make your variables also as ‘long’ in the rest of the code.
Thankyou for your help.
1 Like