As reported: Goldman Sachs Analyst Superday, data structures round with two interviewers (2025): Longest Substring Without Repeating Characters, after Median of Two Sorted Arrays.
Return the length of the longest substring of s that contains no repeated character.
This is LeetCode 3 — Longest Substring Without Repeating Characters.
Example 1
s = "abcabcbb"
-> 3
Example 2
s = "bbbbb"
-> 1
Example 3
s = "pwwkew"
-> 3
Constraints: 0 ≤ s.length ≤ 5·10^4; letters, digits, symbols and spaces.
Code runner format: one JSON value per line: s (LeetCode's test-case format). Implement lengthOfLongestSubstring(s); the harness prints the result as JSON.