Cadence Design Systems interview question

Sorting optimization