Bloomberg interview question

Without using loops & counters, how do you solve this specific problem.