Domanda di colloquio di Pulsenics

Some weird brain teaser and algorithm question