As reported: Okta Senior Software Engineer, round 2 DSA (2025), the first of two problems: LeetCode 3.
Given a string s, return the length of the longest substring without repeating characters. This is LeetCode 3 — Longest Substring Without Repeating Characters.
Example 1
s = "abcabcbb" -> 3 ("abc")
Example 2
s = "bbbbb" -> 1
Constraints: 0 ≤ s.length ≤ 5 · 10^4; s holds English letters, digits, symbols and spaces.
Code runner format: one JSON value per line: s (LeetCode's format). Implement lengthOfLongestSubstring(s); the harness prints the length.