Pergunta de entrevista da empresa Arkansas Blue Cross and Blue Shield

They asked me about time complexity problem