Pergunta de entrevista da empresa Cornerstone OnDemand

Just a basic algorithm question which took into consideration BigO notation.