Painter Problem

You have to paint N boards of length {A0, A1, A2, A3 … AN-1}. There are K painters available and you are also given how much time a painter takes to paint 1 unit of board. You have to get this job done as soon as possible under the constraints that any painter will only paint contiguous sections of board. Return the ans % 10000003

PLEASE CHECK MY CODE AND TELL ME THE ERRORS IN COMMENTS ANS PLEASE CORRECT IT ALSO

Hello @dhruvk3k this is the corrected code:


Happy Learning!!

((paintcal(a,n,p,sum)% 10000003)*t)% 10000003
bhai iss line ka kya matlab hai

Hey @dhruvk3k see in the question it is mentioned that we have to return the final answer after modulo this.
this means if the final answer is big then it will not be big as it will be reduced because of this modulo this we only do when it is mentioned in the question.

bhai but why we do this twice ((paintcal(a,n,p,sum)% 10000003)*t)% 10000003 why we calculated the remainder twice

It would be fine if you do it only once as well.
i have done this twice because it might be possible that the answer returned is greater then the range in any test case.

1 Like