Skip to content

Commit 0f7119f

Browse files
authored
painter's_partition
Initial_File
1 parent d8489bd commit 0f7119f

1 file changed

Lines changed: 19 additions & 0 deletions

File tree

painter's_partition

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
def paint(self, A, B, C):
2+
start=max(C)
3+
end=sum(C)
4+
5+
while(start<=end):
6+
mid=(start+end)//2
7+
painter=1
8+
board=0
9+
for brush in C:
10+
if (board+brush)>mid:
11+
painter=painter+1
12+
board=brush
13+
else:
14+
board=board+brush
15+
if painter<=A:
16+
end=mid-1
17+
else:
18+
start=mid+1
19+
return (start*B)% 10000003

0 commit comments

Comments
 (0)