Applied Intuition interview question

Get this code to work.