Brainium Studios Interview Question

Implement an algorithm for UI purposes.