GlobalLogic Interview Question

algorithm