Pergunta de entrevista da empresa Thoucentric

Coding from data structure. Time complexity.