Rakuten interview question

N queen , longest substring without repeating character