Added solution to first problem. Also fixed some typos in the pseudocode.