Deloitte Interview Question

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