My solution to Yodle's interview code challenge