BENlabs Interview Question

A medium difficulty HackerRank problem