Learn practical skills, build real-world projects, and advance your career

3. longest-substring-without-repeating-characters

Use the "Run" button to execute the code.

!pip install jovian --upgrade --quiet
import jovian

Given a string s, find the length of the longest substring without repeating characters.

Brute force solution:

  1. create empty list, counter sum, and result list
  2. iterate through each position in the string, then iterate through each char starting with index
  3. if the character is not in the list, add it and increase the counter by 1
  4. if it is in the list add the counter sum to the result list reset the counter sum and list to zero and nothing, add that char to list
  5. return the max of the result list