Problem 44, initial attempt.
Use a set for quick value lookup.
Solution for problem 45.
Solution to problem 46.
Solution to problem 48.
Solution to problem 49.