Microsoft Interview Question

Basic array algorithm