Available question text
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.
Related questions
Continue with questions that share topics or the same question type.
Sources · 1 reference
These records explain where the question appears. A company tag or candidate report does not guarantee a future interview question.
Hello Interview · 1 record
Amazon
Leetcode 3104. Find Longest Self-Contained Substring
Reported Jan 15, 2025 · 1 source report
JUNIOR
Source snapshot: Nov 12, 2026
View source