Problem : Painter’s Problem
Last two test cases not working, Please find the error
if you sort the array then it will definitely give wrong ans because it it mention hat any painter will only paint contiguous sections of board. but if you sort the arra then contigous will not remain
s should be equal to max_element of array
Modified Code
Thank You so much for your assistance
Understood your point! 
Marking it as Resolved
Can you also help me with this problem: PRATA(SPOJ)
Didn’t clear the test case:
Number of pratas to be ordered: 10
Number of cooks: 4
Rank array: 1 2 3 4
Expected output: 12
My ans: 6
Please mention the mistake
Sharing my code: