Skip to content

Conversation

@A-Kayode
Copy link
Collaborator

@A-Kayode A-Kayode commented Nov 4, 2022

Parallel Sums
Have the function ParallelSums(arr) take the array of integers stored in arr which will always contain an even amount of integers, and determine how they can be split into two even sets of integers each so that both sets add up to the same number. If this is impossible return -1. If it's possible to split the array into two sets, then return a string representation of the first set followed by the second set with each integer separated by a comma and both sets sorted in ascending order. The set that goes first is the set with the smallest first integer.

For example: if arr is [16, 22, 35, 8, 20, 1, 21, 11], then your program should output 1,11,20,35,8,16,21,22
Examples
Input: [1,2,3,4]
Output: 1,4,2,3
Input: [1,2,1,5]
Output: -1

@A-Kayode A-Kayode requested a review from CaduceusInc November 4, 2022 15:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants