# Algorithm of getting minimum sum for contiguous integer array

Job Description:

1. Problem Description. The creator of Squid Game decided to add one more game for the players. The players are required to form a team of k members to cover a land separated into fields of different areas. Each player must be assigned a number of contiguous fields in the land where he/she have to go through the entire field to collect hidden coins. Assuming that each field can be assigned to only one player, all players must be assigned to at least one field, and that it takes a player 1 unit of time to cover 1 m2 of land, you are required to find an assignment for the players to the fields such that the maximum time it takes a player in the team to cover his/her assigned fields is minimized. The land is represented by an array of integers representing the areas of its fields in m2.

For example, if k = 2 and l = [100, 100, 100, 100], then the optimal solution is to assign Player 1 to the first two fields and to assign Player 2 to the last two fields making the maximum time a player needs 200 units of time. However, if k = 2 and l = [10, 20, 30, 40], then the best solution is to assign Player 1 to the first three fields requiring 60 units of time and to assign Player 2 to the last field requiring 40 units of time making the maximum time a player needs 60 units of time.

2. Deliverables. You are required to submit one Java file named with your ID (example [login to view URL]) containing the following two methods.

a) public static String naive (int k, int[] l) that implements a naive brute force solution for the problem.

b) public static String efficient (int k, int[] l) that implements the most efficient solution you can think of for the problem.

Both methods return a string encoding of the solution represented as follows:

maxTime;P1 fields;P2 fields;...;Pk fields

where maxT ime is the minimized maximum time for a player and Pi f ields for 1 ≤ i ≤ k

are the areas of the fields assigned to Player i separated by commas.

3. Sample Input/Output

k=2, l=[100,100,100,100]

Output: 200;100,100;100,100

k=2, l=[10,20,30,40]

Output: 60;10,20,30;40

Compétences : Java, Algorithme

Concernant le client :
( 1 commentaire ) Cairo, Egypt

Nº du projet : #32626036

## Décerné à:

anhhungcolao

I have read your problem carefully and I'm confident that I can solve this problem. Contact me. ******

%selectedBids___i_sum_sub_4% %project_currencyDetails_sign_sub_5% USD en 1 jour
(0 Commentaires)
0.0

## 10 freelances font une offre moyenne de 25 \$ pour ce travail

esa59cfdec1d6569

Hi there, I checked your requirements and guarantee you it's gonna be done within the next few hours. Let's contact via chat so that I can start work immediately. Wish you the best.

%bids___i_sum_sub_32% %project_currencyDetails_sign_sub_33% USD en 1 jour
(52 Commentaires)
5.2
popularcontent12

Hello, I am a software and Web Developer. I hava also lot of experience in Designing. I have some rules and regulations before start of project: 1. Provide 100% work within deadline. 2. Provide unlimited revisions un Plus

%bids___i_sum_sub_32% %project_currencyDetails_sign_sub_33% USD en 1 jour
(61 Commentaires)
5.2
bitwiz

Hi, I believe I have an efficient solution to this interesting algorithmic problem. Please message me to discuss it further.

%bids___i_sum_sub_35% %project_currencyDetails_sign_sub_36% USD en 5 jours
(22 Commentaires)
4.9
Mr012

Hello I just saw your requirements and after checking it I believe it is something which I can handle easily I'll provide you quality work with perfection as needed with guaranteed best rates you can sent me a message Plus

%bids___i_sum_sub_35% %project_currencyDetails_sign_sub_36% USD en 7 jours
(14 Commentaires)
3.8
ihorkostiuchenko

Algorithm expert. Hi Client, I'll provid you with clear and quick result. I'm Ihor.K algorithm expert with 5 years of experience in C/C++/C#/Python. I have a strong grip on algorithms and data structure as I not only t Plus

%bids___i_sum_sub_32% %project_currencyDetails_sign_sub_33% USD en 1 jour
(0 Commentaires)
0.0
Gnassred

I have more than 10 years experience in programming. I will guarentee you a good quality of work on time and unlimited number of revisions until your satisfaction. Please feel free to contact me in order to discuss yo Plus

%bids___i_sum_sub_32% %project_currencyDetails_sign_sub_33% USD en 1 jour
(0 Commentaires)
0.0