Pregunta de entrevista de Uber

A top difficulty leetcode question