Last active
July 4, 2016 11:51
-
-
Save pranavghate94/afb157ad19386503ec0d79288e40bf87 to your computer and use it in GitHub Desktop.
Revisions
-
Pranav Ghate revised this gist
Jul 4, 2016 . No changes.There are no files selected for viewing
-
Pranav Ghate created this gist
Jul 4, 2016 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,19 @@ function longest(strarr,k){ var start = 0; var end = k; var superstring=''; while(end !== strarr.length+1){ var temp = strarr.slice(start,end).join(''); if(temp.length >= superstring.length){ superstring = temp; } start++; end++; } return superstring; } var test = longest(["zone","abigail","theta","form","libe","zas"],2); console.log(test); This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,2 @@ Native Browser JavaScript >>> abigailtheta