Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
I'm looking for some pointers on making this more efficient. It's failing due to it taking too long to execute the 5500+ tests that this Kata runs.
function transposeTwoStrings(arr) {
var twoStrings = '';
var string1 = arr[0];
var string2 = arr[1];
var longestString = arr.sort(function(a, b) {
return b.length - a.length;
})[0].length;
for (i = 0; i < longestString; i++) {
twoStrings += (string1[i] || ' ') + ' ' + (string2[i] || ' ') + '\n';
}
return twoStrings.slice(0, -1);
}