function longestString() {
var longest = ' ';
for (var i=0; i < arguments.length; i++) {
if(arguments[i].length > longest.length) {
longest = arguments[i];
}
}
return longest;
}
console.log(longestString("asda", "asdasdasd", "12311","akjsdgkjagsdkjagkjdgkajsgdkjas"));
Copy
class Solution:
def lengthOfLongestSubstring(self, s: str) -> int:
if s == '':
return 0;
l = set();
m = 0;
i = 0;
j = 0;
while(i<len(s)):
if(s[i] not in l):
l.add(s[i])
i+=1
else:
m = max(m,len(l));
l.remove(s[j])
j+=1
m = max(m,len(l));
return m;