Pregunta de entrevista de Google

Question on Graphs of medium difficulty level