GlobalLogic Interview Question

Some random array based Leetcode question.