Helmes Interview Question

Logical task