CTCI answer for chapter 1 - Q1 & 2