Tested and working. For easy understanding, I suppose there's a drawer to put the letters.
Function:
public int lengthOfLongestSubstring(String s) {
int maxlen = 0;
int start = 0;
int end = 0;
HashSet drawer = new HashSet();
for (int i=0; imaxlen) {
maxlen=_maxlen;
}
}
}
return maxlen;
}