Bloomberg interview question

one leetcode style question: longest substring