Categorygithub.com/koykov/algoexpert.iolongest-substring-without-duplication
package
0.0.0-20240615115840-a222ecda5fb5
Repository: https://github.com/koykov/algoexpert.io.git
Documentation: pkg.go.dev

# README

Longest Substring Without Duplication

Category: Strings

Difficulty: Hard

Description

Write a function that takes in a string and returns its longest substring without duplicate characters.

You can assume that there will only be one longest substring without duplication.

Sample Input

string = "clementisacap"

Sample Output

"mentisac"

Optimal Space & Time Complexity

O(n) time | O(min(n, a)) space - where n is the length of the input string and a is the length of the character alphabet represented in the input string