Turing interview question

30 Minute coding challenge, algorith based.