Pergunta de entrevista da empresa Uber

The first is based on arrays and sorting and the second one is based on graphs. we have to type the code for solving some given problem