EOH interview question

Codility test