Solutions to 2nd and 3rd

Fixed the bug found in the 2nd solution, with that also the 3rd
assignment is complete.