Solved problem #38
Solved problem #39. Correct but takes 2 minutes to find solution.
Should be refactored to find quickier.