I’m only getting the correct answer in one of the test cases.
Where is my mistake?
MY code: https://ide.codingblocks.com/s/283011
Painter's Partiton
Hey Arsh,
- don’t sort the array
- scale ans (multiply by t) in last
- check if b[i]>mid then return false
- take all types as long long
here is debugged code
https://ide.codingblocks.com/s/283012
1 Like
Hi, Thanks for the response. What is the problem being caused by sorting of the array? I understood the problems in the rest of cases except this one.
sections needs to be painted in contiguous fashion, sorting the array destroys the order!
2 Likes
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.