How to get longest substring in a string with no repeating character?? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

How to get longest substring in a string with no repeating character??

11th Oct 2017, 9:01 PM
ayush agarwal
ayush agarwal - avatar
2 Answers
+ 2
Here's one way to do it (using set): https://code.sololearn.com/cM8B5fwuXPgm/?ref=app Actually read the tags, and realized there's no C++. Anyway, here's Java translation: https://code.sololearn.com/clF7bxqRWd54/?ref=app Sorry if there are more bugs than lines of code. I'm not familiar with Java at all. Consider it a 'googletranslate'.
11th Oct 2017, 10:22 PM
deFault
0
The code I've posted here was broken. It didn't work in many cases. I think I've fixed it now. Still not sure how to test it though.
13th Oct 2017, 9:29 PM
deFault