problem 2 alternate method