Cadence Design Systems interview question

Pseudo code a search function