1st JLTi Code Jam – Mar 2017
Input: 1, 1, 2, 2, 2, 567, 567, 10000076, 4, 2, 3, 3
Explanation: There are 12 people listed above. They belong to 6 teams (Team 1, Team 2, Team 3, Team 567, Team 10000076, and Team 4). As you can see people are identified in the list by the team number.
Output: 1, 2, 1, 2, 4, 2, 567, 3, 567, 100076, 2, 3
As you can see, the output has rearranged the team members in way that no two members from the same team standing next to each other.
Input: 1, 1, 1, 1, 2
Output: It is not possible to rearrange them.
Task: You have to write a program that can rearrange even billions of such team members belonging to millions of teams very fast. If the input is such that it is not possible to rearrange then the output should be: It is not possible to rearrange them. A correct solution is not sufficient. The algorithm has to be efficient, otherwise the output for big data 🙂 will not come.