Infosys interview question

Find length of longest substring. Design patterns. Java Trivia