Use two pointers, 'left' and 'right', to define the current substring.
Use a vector 'mpp' as a hash map to store the last seen position of each character.
Expand the window by moving the 'right' pointer and update the hash map.
If a repeating character is found, move the 'left' pointer to exclude the previous occurrence.
Keep track of the maximum length of non-repeating substring seen so far.
left and right to represent the current window of unique characters.mpp of size 256.s[right] is found within the window (left to right), move left to the index after its last occurrence.right - left + 1) and update the maximum length.right reaches the end of the string and return the maximum length.Here’s the code: