my solution to assign2