Pregunta de entrevista de Meta

I was asked 1 coding question, it was array based