Longest Substring With No Duplicate Characters (Medium)

Good afternoon! Here's our prompt for today.

You may see this problem at Intercom, Pivotal, Nvidia, Canva, Segment, Carta, Figma, Weave, Amplitude, 3m, Veeva Systems, and Digitate.

Given a string of characters, can you find the longest substring of the string that has no repeating characters?

An example is shown below:

Description
JAVASCRIPT
1lengthOfLongestSubstring("abracadabar");
2// 4 because it is 'brac'

Constraints

  • Length of the string <= 100000
  • The string will only contain lowercase letters
  • Expected time complexity : O(n)
  • Expected space complexity : O(1)

In this challenge, we'll discuss a simple but efficient method for finding the longest substring with no repeating characters.

JAVASCRIPT
OUTPUT
Results will appear here.