Pergunta de entrevista da empresa Bloomberg

I was asked 2 graph problems