Pregunta de entrevista de Tata Consultancy Services

Arrays medium level question from leet code.