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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started