Pregunta de entrevista de Google

check leetcode.com it's accurate from there.