Add (highly unoptimized) solution to problem 3