Front interview question

Array logic question