Pregunta de entrevista de Smart Energy Water

leetcode question was asked to solve