Demica interview question

Coding test.