Created
December 31, 2016 16:24
-
-
Save zeropaper/484193dcbaec2cbf689aa5a61231f559 to your computer and use it in GitHub Desktop.
This file contains 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 characters
function sharedStart(array) { | |
var A= array.concat().sort(), | |
a1= A[0], a2= A[A.length-1], L= a1.length, i= 0; | |
while(i<L && a1.charAt(i)=== a2.charAt(i)) i++; | |
return a1.substring(0, i); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment