>_
Compiler Shell v1.0.4
Connection to data node secure.
Parsed 600 algorithm challenges.
Mounted telemetry indexes.
> Launching prep command center...
Compiling 0%
Medium 💻 Coding

[Operating Systems] Longest Substring Without Repeating Chars

Problem Statement

Problem Statement for Longest Substring Without Repeating Chars under Operating Systems:

Given a string s, find the length of the longest substring without repeating characters.

Input Constraints:
- 1 <= len(nums) <= 10^5
- Elements fit in memory standard spaces.

Proposed Solution

def lengthOfLongestSubstring(s):
    char_map = {}
    left = 0
    max_len = 0
    for right, char in enumerate(s):
        if char in char_map and char_map[char] >= left:
            left = char_map[char] + 1
        char_map[char] = right
        max_len = max(max_len, right - left + 1)
    return max_len

Your Progress

Pending Completion

Save Progress?

Login to sync your solutions across all dynamic local and remote sessions.

Join Techlance
Back to Curriculum