You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Given K painters to paint N boards where each painter takes 1 unit of time to paint 1 unit of boards i.e. if the length of a particular board is 5, it will take 5 units of time to paint the board. Compute the minimum amount of time to paint all the boards.
2
+
3
+
Note that:
4
+
5
+
Every painter can paint only contiguous segments of boards.
6
+
A board can only be painted by 1 painter at maximum.
7
+
Input Format
8
+
First line contains K which is the number of painters. Second line contains N which indicates the number of boards. Third line contains N space separated integers representing the length of each board.
9
+
10
+
Constraints
11
+
1 <= K <= 10
12
+
1 <= N <= 10
13
+
1<= Length of each Board <= 10^8
14
+
15
+
Output Format
16
+
Output the minimum time required to paint the board.
0 commit comments