EY interview question

Simple dsa question from strings and array