In a computer game, two sets of numbers flashed on the screen for a few seconds. Players need to calculate the of the numbers in each of the sets. If the resulting sum is odd for either of the two sets, then the players need to identify if swapping any numbers between the two sets would make the resulting sum even in both the sets. The task is to write a code to identify the minimum number of swaps required to ensure that the resulting sum of each of the two sets of numbers is even If there is no possibility of achieving this, then the output needs to be flagged as -1.
venkat14m / tcs-digital-code Goto Github PK
View Code? Open in Web Editor NEWIn a computer game, two sets of numbers flashed on the screen for a few seconds. Players need to calculate the of the numbers in each of the sets. If the resulting sum is odd for either of the two sets, then the players need to identify if swapping any numbers between the two sets would make the resulting sum even in both the sets. The task is to write a code to identify the minimum number of swaps required to ensure that the resulting sum of each of the two sets of numbers is even If there is no possibility of achieving this, then the output needs to be flagged as -1.