ChannelNet Interview Question

How would you optimize this algorithm?