I am just able to pass 1 test case but the sample test case is passing in IDE . Can you please let me know where i am getting wrong…
Painter problem
hello @rahul.aggarwal000005
a) t is constant and same for all painters so solve ur question by assumming t=1 and then later multiply ur answer by t to get actual correct answer. this is done to avoid overflow.
b) use long long datatype in place of int.
i have tried it but still no test case is passing and i have changed all the int to long long int still it is not passing
since array is not sorted .
ur s should initialise with maximum value in array .(u are always using a[n-1] to initialse it).
also pls refer my point a.
check ur corrected code here.