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.
Hi - thanks very much for the translation and sorry for the slow response as I've not been on Codewars for a few months. I've merged your translation, (although I'm not too familiar with C# so not really in a position to give valid feedback on it!).
Hi - I think you're right. I agree that order of object properties shouldn't matter. The problem is with Test.assertSimilar, which I had assumed did a deep equality check, but in fact just converts the object to a string representation and then compares that. I've had to write a small helper function
testDeepEqual
to do actual deep equality checking (using lodashisEqual
). So issue should be fixed.yeah pretty basic error - and it's not the first time I've made that mistake either! Thanks for the feedback and yes - I agree, makes sense to delete the above code.
Hi - thanks for posting the example and for the positive feedback (even though kata has such an annoying bug). I think I found the problem (I had a sort function that was was returning a < b rather than a - b... which explains why it worked for the first test cases but failed on random data. Hope that fixes it. Let me know.
Yeah looks like a bug based on what you've posted. If it's easy, please do post whole chunk of code and I'll have a proper look tomorrow. To be honest I can't remember much about this kata (it's not exactly been popular), but I'll have a look as at least I'm coming back to it with fresh eyes.
The function can take more than 3 objects as arguments. Are you using all arguments or just the first three?
Ah ok - I'm more of a frontend web person so my Ruby is a bit unpolished. But I think what you're looking for is the splat operator, which gathers all args into an array (like the spread operator in JavaScript). Haven't actually tried my own kata in Ruby so not sure I'm qualified to help, but hope that's of some use!
Sorry @veronicacannon - didn't realise that flagging it stopped people seeing my comments (thought it just flagged it up as potentially spoiler so gave you the option). Have unflagged it now.
Two options in Javascript:
Option 1 works on all browsers, so is more universal. Option 2 syntax is much nicer. Hope this helps. Good luck!
Glad you liked the kata. This is not an error. Compounding only occurs every 2 years, so the result for 6 and 7 years is the same. I put an example of this in the JavaScript description, so will try and update this in the Python version too (I'm not too familiar with Python, but I'll give it a go)
Thanks - I've updated it
This comment is hidden because it contains spoiler information about the solution
That's great - thanks Giacomo
Thanks for the suggestion - I can certainly see there is an advantage in having consistent types in the return value. The aim of my solution was to have a return like
[[1,2], ,[21,22], ,[40]]
rather than explicitnull
values because this works nicely with Array.map and Array.forEach (by just iterating over the values actually set). The problem I think is the wayTest.assertSimilar
does the comparison, which sees an empty element in the array asnull
so would see the array[1, null, 3]
as similar to[1, , 3]
.Hi - I've updated the kata and restricted the random tests to relatively small numbers, which I think may have been the cause of the problem. Hope it works, if not let me know.
Loading more items...