java.lang.Object
g0001_0100.s0003_longest_substring_without_repeating_characters.Solution

public class Solution extends Object
3 - Longest Substring Without Repeating Characters.<p>Medium</p> <p>Given a string <code>s</code>, find the length of the <strong>longest substring</strong> without repeating characters.</p> <p><strong>Example 1:</strong></p> <p><strong>Input:</strong> s = &ldquo;abcabcbb&rdquo;</p> <p><strong>Output:</strong> 3</p> <p><strong>Explanation:</strong> The answer is &ldquo;abc&rdquo;, with the length of 3.</p> <p><strong>Example 2:</strong></p> <p><strong>Input:</strong> s = &ldquo;bbbbb&rdquo;</p> <p><strong>Output:</strong> 1</p> <p><strong>Explanation:</strong> The answer is &ldquo;b&rdquo;, with the length of 1.</p> <p><strong>Example 3:</strong></p> <p><strong>Input:</strong> s = &ldquo;pwwkew&rdquo;</p> <p><strong>Output:</strong> 3</p> <p><strong>Explanation:</strong> The answer is &ldquo;wke&rdquo;, with the length of 3. Notice that the answer must be a substring, &ldquo;pwke&rdquo; is a subsequence and not a substring.</p> <p><strong>Example 4:</strong></p> <p><strong>Input:</strong> s = &quot;&quot;</p> <p><strong>Output:</strong> 0</p> <p><strong>Constraints:</strong></p> <ul> <li><code>0 <= s.length <= 5 * 10<sup>4</sup></code></li> <li><code>s</code> consists of English letters, digits, symbols and spaces.</li> </ul>
  • Constructor Details

    • Solution

      public Solution()
  • Method Details

    • lengthOfLongestSubstring

      public int lengthOfLongestSubstring(String s)