My solution to a company's interview questions