Write a function called findLongestSubstring, which accepts a string and returns the length of the longest substring with all distinct characters.

I don’t understand how the use-cases answers come to be?

findLongestSubString("thisisawesome") // 6 (my answer is 5 because "isawe" is longest), the rest of use cases im baffled as well.
findLongestSubString("thecatinthehat") // 7
findLongestSubString("longestsubstring") // 8
findLongestSubString("thisishowwedoit") // 6

The substring doesn’t have to start at the beginning, so you have lots of options to check.

For the first string, ‘awesom’.

1 Like

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.