8 Lines of Python code , TC: O(N) =>The easiest way anyone can understand, with 97% TC and 99% SC
\nresult =""\nmax_length = 0\nfor i in s:\n\tif i in result:\n\t\tresult = result[result.index(i)+1:]\n\t\t"""if abcdas is the string, here after abcd the lengt
```\nresult =""\nmax_length = 0\nfor i in s:\n\tif i in result:\n\t\tresult = result[result.index(i)+1:]\n\t\t"""if abcdas is the string, here after abcd the length would be 4 and result will be replaced as bcda"""\n\tresult += i\n\tmax_length = max(max_length, len(result))\nreturn (max_length)\n```\n\n\nif you understand, please upvote :).\nwill build my confidence\nthank you :)
['Python']