/**
* @param {string} s
* @return {number}
*/
var lengthOfLongestSubstring = function(s) {
var arr = [], i_count = 0, j_count = 0, max_count = 0, _s = ""
for(var i = 0; i < s.length; i++){
var c = s[i]
var k = _s.indexOf(c)
if(k > -1){
_s = _s.substring(k+1)
}
_s += c
if(_s.length > max_count){
max_count = _s.length
}
}
return max_count
};
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.