Reported September 2026
Superhumansliding window

Longest Distinct String

Reported by candidates from Superhuman's online assessment. Pattern, common pitfall, and the honest play if you blank under the timer.

Get StealthCoderRuns invisibly during the live Superhuman OA. Under 2s to a working solution.
Founder's read

The Superhuman OA reported in September 2026 looks fancy, but it's the classic longest substring without repeating characters. Strip the wrapper and it's a sliding window over a string with a last-seen lookup. If your invite says 48 hours, this is one of the good draws. It's short, the pattern is well known, and there's only one real trap. You can solve it in about ten lines. If your mind goes blank mid-assessment, StealthCoder sits invisibly on your screen and hands you the window logic so you can finish clean.

The problem

Given a string s, return the length of its longest contiguous substring in which no character appears more than once.
A substring is a contiguous sequence of characters within s. Return only the maximum length, not the substring itself.

Function
longestDistinctString(s: String) → int

Examples
Example 1
s = "abcc"
return = 3
The substring "abc" contains no repeated character and has length 3.
Example 2
s = "abcabcbb"
return = 3
Substrings such as "abc" have length 3, and every longer substring repeats a character.
Example 3
s = "bbbbb"
return = 1
Every distinct-character substring contains only one b.

Constraints
1 <= s.length <= 100000
s contains printable ASCII characters.

Reported by candidates. Source: FastPrep

Pattern and pitfall

The trick is a sliding window with a hash map from character to last seen index. Walk right pointer i across the string. If s[i] was seen at an index at or after left, jump left to that index plus one. Then record the window length i - left + 1 and update the best. That's O(n) time and O(1) extra space, since printable ASCII caps the map at 128 or so entries. The common pitfall is moving left backward. If a character was seen before the current window, you must ignore it, so take the max of left and last+1. Another slip is returning the substring when the task wants only the length. Constraints go up to 100000, so brute force over all substrings will time out. If you freeze on the pointer logic, StealthCoder is the hedge during the live OA, giving you the working template fast.

If you see this problem in your OA tomorrow, the play is to recognize the pattern in 30 seconds. StealthCoder buys you that recognition.

If this hits your live OA

You can drill Longest Distinct String cold, or you can hedge it. StealthCoder runs invisibly during screen share and surfaces a working solution in under 2 seconds. The proctor sees the IDE. They don't see what's behind it. Built by an Amazon engineer who passed his OA cold and still thinks the filter is broken.

Get StealthCoder

Related leaked OAs

⏵ Practice the LeetCode equivalent

This OA pattern shows up on LeetCode as longest substring without repeating characters. If you have time before the OA, drill that.

⏵ The honest play

You've seen the question. Make sure you actually pass Superhuman's OA.

Superhuman reuses patterns across OAs. Built by an Amazon engineer who passed his OA cold and still thinks the filter is broken. Works on HackerRank, CodeSignal, CoderPad, and Karat.

Longest Distinct String FAQ

How hard is the Superhuman Longest Distinct String question really?+

It's medium difficulty, but a very common one. If you know sliding window, you finish in minutes. The only real difficulty is handling the left pointer correctly when a repeat appears outside the current window.

What's the trick to solving it?+

Keep a map of each character's last index and a left pointer. When you see a repeat inside the window, move left to last index plus one. Track the max of i - left + 1 as you go. One pass, linear time.

Will brute force pass?+

Probably not. With length up to 100000, checking every substring is O(n^2) or worse. Use the single-pass sliding window so you stay at O(n) and avoid timeouts.

Is this pattern still asked in 2026 OAs?+

Yes. Sliding window on strings keeps showing up, and this Superhuman report from September 2026 is a direct example. Expect variants like at most k distinct characters or replacement limits.

How do I prepare in 48 hours?+

Write this solution from memory twice, once with a set and shrinking window, once with a last-seen map. Test on abcc, abcabcbb, bbbbb, and a single character. Then skim related window problems so edge cases feel familiar.

Problem reported by candidates from a real Online Assessment. Sourced from a publicly-available candidate-aggregated repository. Not affiliated with Superhuman.

OA at Superhuman?
Invisible during screen share
Get it