EY Interview Question

Simple dsa question from strings and array