As reported: JPMorgan Chase SDE (Java) round 1 (Feb 2026): Longest Substring Without Repeating Characters, followed by Java questions.
Given a string s, return the length of the longest substring (a contiguous block) that contains no repeated character.
This is LeetCode 3 — Longest Substring Without Repeating Characters.
Example 1
s = "abcabcbb" -> 3 "abc"
Example 2
s = "bbbbb" -> 1 "b"
Example 3
s = "pwwkew" -> 3 "wke" ("pwke" is a subsequence, not a substring)
Constraints: 0 ≤ s.length ≤ 5 · 10^4; s consists of English letters, digits, symbols and spaces.
Code runner format: one line holding s as a JSON string. Implement lengthOfLongestSubstring(s); the harness prints the length.