Infosys interview question

Longest substring question and sql joins