D2iQ interview question

start/finish the coding challenge.