C#: Find the length of the longest substring without repeating characters from a given string
Write a C# Sharp program to find the length of the longest substring without repeating characters in a given string.
Note:
1) Given string consists of English letters, digits, symbols and spaces.
2) 0 <= Given string length <= 5 * 104
Difficulty: Medium.
Company: Amazon, Google, Bloomberg, Microsoft, Adobe, Apple, Oracle, Facebook and more.
Input String : pickoutthelongestsubstring
The longest substring : ubstring
The longest Substring Length : 8
Input String : ppppppppppppp
The longest substring : p
The longest Substring Length : 1
Input String : Microsoft
The longest substring : Micros
The longest Substring Length : 6
Sample Solution:
C# Sharp Code:
Sample Output:
Original String: aaaaaabbbbccc Length of the longest substring without repeating characters of the said string: 2 Original String: BDEFGAABEF Length of the longest substring without repeating characters of the said string: 6 Original String: Python Length of the longest substring without repeating characters of the said string: 6 Original String: Java Length of the longest substring without repeating characters of the said string: 3
Flowchart :

C# Sharp Code Editor:
Improve this sample solution and post your code through Disqus
Previous: Write a C# Sharp program to remove duplicate characters from a given string.
Next: Write a C# Sharp program to reverse the case (upper->lower, lower->upper) of all the characters of given string.
What is the difficulty level of this exercise?
Test your Programming skills with w3resource's quiz.