Pergunta de entrevista da empresa Cadence Design Systems

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

Resposta da entrevista

Sigiloso

23 de abr. de 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.