Longest Substring Without Repeating Characters — C# Coding Problem
Difficulty: medium | Category: string
Problem Description
Given a string `s`, find the length of the longest substring without repeating characters. Hint: Use a sliding window — keep a set of current characters, expand the right pointer, and shrink the left pointer when a duplicate is found.
Examples
Example 1
Input: s = "abcabcbb"
Output: 3
Explanation: The answer is "abc" with length 3.
Example 2
Input: s = "bbbbb"
Output: 1
Explanation: The answer is "b".
Example 3
Input: s = "pwwkew"
Output: 3
Explanation: The answer is "wke" with length 3.