Deloitte interview question

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