Abnormal AI interview question

How can we optimize the current implementation