Orange interview question

codility challenge