Your Dashboard
Interview Coaching
Learn
System Design
ML System Design
Code
Behavioral
Salary Negotiation
Interview Guides
Leetcode 3104. Find Longest Self-Contained Substring
Find the longest substring such that every character in that substring has all of its occurrences contained within it (i.e., no character from the substring appears outside it). This reduces to computing each character's first/last index and merging overlapping intervals (or using a two-pointer/scan) to identify the longest valid segment.
Asked at:
Amazon
Question Timeline
See when this question was last asked and where, including any notes left by other candidates.
Mid January, 2025
Amazon
Junior
Find the longest self-sufficient substring in a given string. A self-sufficient substring cannot be the full string, and no letter in the substring can occur both inside and outside the substring. Return the length of the longest such substring, or 0 if none exists.
Mid January, 2025
Amazon
Junior
Find the longest self-sufficient substring in a given string. A self-sufficient substring cannot be the full string, and no letter in the substring can occur both inside and outside the substring. Return the length of the longest such substring, or 0 if none exists.
Comments
Hello Interview Premium
Your account is free and you can post anonymously if you choose.