Longest Substring Without Repeating Characters
Given a string, find the length of the longest substring without repeating characters. For example, the longest substring without repeating letters for "abcabcbb" is "abc", which the length is 3. For "bbbbb" the longest substring is "b", with the length of 1.
Solution: use two pointers start and end; use hash map to store the characters. 2013-05-22 redo it. almost the same solution... My solution is inefficient since clearing the hash table is a waste of time. Using pointers to record the position should be a better solution.
Solution: use two pointers start and end; use hash map to store the characters. 2013-05-22 redo it. almost the same solution... My solution is inefficient since clearing the hash table is a waste of time. Using pointers to record the position should be a better solution.
Comments
Post a Comment