Dataford
Interview QuestionsInterview GuidesExperiencesMock InterviewsPricing
Get started

Longest Unique Substring in Eno

MediumPython00:00
Practice interviewer
In session
5 left
00:00

Your question is Longest Unique Substring in Eno. Start with the requirements on the right.

Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.

You need to log in / sign up to run or submit.

Problem

In Capital One's Eno chat experience, repeated characters can indicate noisy input. Given a string s, write a function that returns the length of the longest substring that contains no repeated characters.

A substring must be contiguous. Your solution should run efficiently for large inputs.

Input and Output

  • Input: A string s
  • Output: An integer representing the maximum length of a substring with all unique characters

Constraints

  • 0 <= len(s) <= 10^5
  • s contains printable ASCII characters
  • A substring must be contiguous
  • Return the length of the substring, not the substring itself

Function Signature

def longest_unique_substring(s):
Your solutionPython 3
You need to log in / sign up to run or submit.
Run your code to see test output