my code is not working for 1 test case
input: “au”
output should be 2
but my code is giving 1
Longest-substring-without-repeating-characters
The initialisation of -1 in visited is wrong way. You can only use this way when u want to initialise with 0. Use memset for initialisation in visited array. Rest of ur code is correct.