Problem #62
Magic in Boxland
A magician lives in a mysterious Boxland that comprises of eight cities and all of them contain 6 magic wands. Each wand has been colored with one of n colors, such that no two wands in the same cities are of same color, and no two colors occur together in more than one city. The smallest number n that satisfies this condition is used by the magician to create a ball-box challenge that contains a 2-D array of size n * n of such boxes placed adjacent to each other satisfying following conditions:
- Every box that does not contain a ball shares a side with one which does.
- Given any pair of boxes that contain balls, there is a sequence of boxes containing balls, starting and ending with the given boxes, such that every two consecutive boxes of the sequence share a side.
Find the smallest number of balls that must be there inside those boxes multiplied by 3.
(i.e. Answer = [Total number of balls inside the array of boxes] x 3)