Improved solution to Problem 15 by using combinatoric solution.