exercise 2 in TimeComplexity, scored 100%