Pregunta de entrevista de Google

Algorithm based Leetcode Hard question