Longest Self-Contained Proper Substring

Asked at Amazon · Coding Questions · Difficulty: Medium

A substring is *self-contained* if every character in it appears nowhere else in the full string. Return the length of the longest self-contained substring that is a **proper** substring (not the whole string), or `0` if none exists.

Loading the problem…