Painter Problem

only one test case is passing by my code for this problem

hello @dhruvprashar
a) dont sort the board because painter can only paint contigous blocks

search space s=max in array * t
e= summation *t

b) use long long to avoid overflow

now 4 cases passed 2 left https://ide.codingblocks.com/s/257707

u have not intiialised ur ans correctly.
it should be ans=e;

still getting only 4 cases cleared

image
here k should be t ,
and t should be k.

ur updated code

thank you very much:)