Pergunta de entrevista da empresa Uber

Coding question - average difficulty