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.
actually not the same
This comment is hidden because it contains spoiler information about the solution
I've added a translation to Ruby. Please check and approve.
@bkaes: Wow, thank you so much. Here was the point:
up to f(68) (aka 69 numbers)
Thanks, will be waiting for the answer. But I guess this issue is applicable to Python too, because the test case is the same: test.assert_equals(count_odd_pentaFib(68), 23).
Hi, Haskell
My solution passes the tests, but not this one: it "should return 23 on 68" $ countOddPentaFib 68
shouldBe
23.Due to my function I have 22, not 23. I checked the sequence and counted 23 numbers with two times '1', so the output should be 22. What point have I missed?
Just to verify: the 68th element of the sequence is 12778498417777343135.
Added example test cases.
As I mentioned earlier, I have already done it. You can see and check JS translation if you press '+' button in the top of the page near the Python logo.
I translated this kata into JS, but it should be renamed. Is there any possibility to do it?
Expected: Hello World!, instead got: Helo World!
Couldn't pass the test. What does it mean?
Expected: 0, instead got: 1
10 Passed
1 Failed
I wonder, what is for '0', as it is expected by the 11th test?
You can create arrays like that: new Array(n), where n is quantity of elements. For example, new Array(3) will produce [undefined, undefined, undefined]. Besides, every array has join method, which creates a string from the array's elements and join's argument will play as separator, so that [1,2,3].join('anyStringYouLike') will be evaluated in '1anyStringYouLike2anyStringYouLike3'. And [undefined, undefined, undefined].join('String') will be evaluated in 'StringString'.
Hope this explanation will help to undestand this solution.
very helpful, thanks
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]);
});
}
Loading more items...