BBD interview question

ten code challenge to solve in two hours.