solved ex2 of probset3 opt2