Question: You are given 9 balls. 8 of them weigh the same while 1 is heavier than the others. How can you determine which ball is the odd one out using just two comparisons?
Let's simplify this problem using just 3 balls. If we were given 2 balls that weighed the same and one that were heavier, how would we solve this using just 1 comparison?
We can easily do this by picking any two random balls and weighing them against each other.
Simple enough, right? Now with nine balls, we can do a similar.
Get it? 27 balls and 3 comparison should be a cinch now. ;-)
Came up with a better solution or have a question? Comment below!
Next Challenge: Reverse a String