Pregunta de entrevista de Scale

One DSA question (easy level)