Applied Intuition Interview Question

Get this code to work.