Nokia interview question

Easy to Medium Array DSA question.