Ad
  • Custom User Avatar

    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!).

  • Custom User Avatar

    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 lodash isEqual). So issue should be fixed.

  • Custom User Avatar

    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.

  • Custom User Avatar

    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.

  • Custom User Avatar

    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.

  • Custom User Avatar

    The function can take more than 3 objects as arguments. Are you using all arguments or just the first three?

  • Custom User Avatar

    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!

  • Custom User Avatar

    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.

  • Custom User Avatar

    Two options in Javascript:

    1. Use the arguments object see: https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Functions/arguments
    2. Use rest parameters (es6 feature that works on CodeWars), see https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Functions/rest_parameters

    Option 1 works on all browsers, so is more universal. Option 2 syntax is much nicer. Hope this helps. Good luck!

  • Custom User Avatar

    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)

  • Custom User Avatar

    Thanks - I've updated it

  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Custom User Avatar

    That's great - thanks Giacomo

  • Custom User Avatar

    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 explicit null 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 way Test.assertSimilar does the comparison, which sees an empty element in the array as null so would see the array [1, null, 3] as similar to [1, , 3].

  • Custom User Avatar

    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...