Pergunta de entrevista da empresa Thomson Reuters

Coding question on hackerrank, then asked for time/space complexity