Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

longest string

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"));
Comment

longest substring

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;
Comment

PREVIOUS NEXT
Code Example
Javascript :: image react native base64 
Javascript :: nestjs queues 
Javascript :: js to find min value in an array 
Javascript :: How to display multiple input value in JavaScript 
Javascript :: how to connect a swagger ui express 
Javascript :: lodash groupby return array 
Javascript :: how to add icon in javascript 
Javascript :: how to make an object in javascript 
Javascript :: javascript set() method 
Javascript :: javascript even number 
Javascript :: javascript ternary operator syntax 
Javascript :: How to pass methods in vue js 
Javascript :: what is closure 
Javascript :: angular route 
Javascript :: angular set time 
Javascript :: big o theory 
Javascript :: run javascript in atom 
Javascript :: send request express 
Javascript :: class 
Javascript :: set get variable in url 
Javascript :: mock javascript function 
Javascript :: map values js 
Javascript :: what is prototype in javascript 
Javascript :: js code for webpage download progress bar 
Javascript :: show password eye icon angular 9 
Javascript :: crone expression in spring boot 
Javascript :: counter react 
Javascript :: angular import service 
Javascript :: some in js 
Javascript :: update data in sequelize 
ADD CONTENT
Topic
Content
Source link
Name
9+8 =