Quest Global Interview Question

Simple algorithm and basics.