GO Solution For UVa 10054 - The Necklace. In this post we will see how we can solve this challenge in GoLang for UVa Online Judge.

Problem Description

My little sister had a beautiful necklace made of colorful beads. Two successive beads in the necklace shared a common color at their meeting point. The figure below shows a segment of the necklace:

But, alas! One day, the necklace was torn and the beads were all scattered over the floor. My sister

...

You can find the full details of the problem The Necklace at UVa Online Judge

Sample Input

2
5
1 2
2 3
3 4
4 5
5 6
5
2 1
2 2
3 4
3 1
2 4

Sample Output

Case #1
some beads may be lost

Case #2
4 3
3 1
1 2
2 2
2 4

Solution: Please check the main.go snippet for the solution.

Solution originally posted at: Github by @codingsince1985