Qneuro interview question

Array based DSA question in java