Pregunta de entrevista de Trimble MAPS

Question on Graph (leetcode medium)