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.
Please see the issue I filed above on the Python translation.
I'm guessing Jake Hoffner (jhoffner) would have to figure it out. I don't see any reference to a translation in the Kata Editor, and I don't see anything on your profile for published kata.
You're right, _sort will be called every iteration, so you can try to sort array2 outside the loop for a better performance (see bellow). Or you have another vision for completing this task?
function comp(array1, array2){
function _sort(arr) { return arr.sort(function(a,b) { return a-b; }); }
array2 = _sort(array2);
return !array1 || !array2 ? false : _sort(array1).every(function(elm,i) {
return elm === Math.sqrt(array2[i]);
});
}
I'm not seeing it for some reason.
I'll try it out now!
The problem doesn't make sense if, from the start, we have window height >= building height... so return -1 because we return, in normal cases an int. Otherwise we could have return nil/null/None .../Nonsense!
You should specify what is the desired behavior when duplicates exist in any of the three arrays. My solution passes with 50% probability... :-) I'm definitely not trying anything more efficient than this, until this issue is fixed.
Guess someone should probably add a test for that, huh?
Defining functions on prototype is usually a better idea: http://stackoverflow.com/questions/4508313/advantages-of-using-prototype-vs-defining-methods-straight-in-the-constructor
Nope @arichidoru, in fact it's even clearer the way you've put it. []s
Yes, that's the point the kata wants to teach.