Domanda di colloquio di Deloitte

They asked me to write a quick algorithm based on a given statement