Cadence Design Systems interview question

Data structure question, two pointer technique question