Pregunta de entrevista de Accenture

Coding question based on array and string