Apolis Interview Question

They asked me to solve a simple java array challenge