LiveRamp Interview Question

An algorithm question related to one-dimensional array. Not that hard. Average effort to solve it.