Pergunta de entrevista da empresa Lyft

Was not expecting graph theory question