Solved these problems while helping roommate study