Gets Solution

Updated the code to correctly solve the problem.