employer cover photo
employer logo
employer logo

Cadence Design Systems

Engaged Employer

Cadence Design Systems Interview Question

given a string, find the longest substring that starts and ends in the same letter

Interview Answer

Anonymous

Apr 23, 2025

I used two maps (or histograms if you want to make sure it's O(1)) in order to save the earliest index of the letters in the ABC and the latest. Returned the letter that the difference between the two was the highest.