Why the browser expected result defferent from site Expected??


  • 0
    T
    var lengthOfLongestSubstring = function(s) {
        var stringArray = s.split("");
        var string = '';
        for(var i=0;i<stringArray.length;i++){
            if(string.indexOf(stringArray[i]) == -1){
                string += stringArray[i];
            }else{
                return string.length;
            }
        }
        return string.length;
    };

Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.