Question: Consider an array inarr containing at least two non-zero positive integers ranging between 1 to 300 (inclusive of the boundary values). Divide the integers in

Consider an array inarr containing at least two non-zero positive integers ranging between 1 to 300 (inclusive of the boundary values). Divide the integers in inarr into two groups based on the below rules.

1. Each of the integers should belong to each of the two groups.

2. The total sum of integers in each of the groups must be as nearly equal as possible.

3. The total number of integers between the two groups should not differ by more than 1.

Print outnum1 and outnum2, the sum of the integers of two groups separated by a space. if outnum1 and outnum2 are not equal, then print the smaller sum followed by the larger sum.

*Please do in java*

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!