first 2 test cases are not passing. Please help finding the error?
Painter Problem
as per problem statement "any painter will only paint contiguous sections of board. ".
so order of input has very much importance. which means you must not sort the input.
remove this part // sort(a,a+n); and everything else is fine.
thanks