The advanced problem for Yodle's interview process written in Java. (Other languages may be more suitable for this problem)