Ad
  • Custom User Avatar
    • No random tests.
    • Java naming conventions for method names is camelCase
    • Since the return value is of unknown size I would suggest to change return type to List<Character>.
    • Please add inputs to assertion messages.
    • Please use assertEquals(list, list, msgWithInputs) to have proper assertion messages.

    I will reject this translation for the above reasons. You are free to fix them by forking this translation.

  • Custom User Avatar

    Even though it is marked as 7-kyu, the tests are very challenging and have been sometimes unclear for me personally. I struggled with passing some of them and literally had to guess what they were asking for. It would be cool to update the visible tests a bit to better match the hidden ones. Anyway, thanks for this Kata!

  • Custom User Avatar

    B4B is right, your solution works incorrectly when it's run twice in a row.

    It's a bug in your solution, not a kata issue.

  • Custom User Avatar

    Hi,

    • are you mutating the input?
    • are you using global variables (I'd bet on that one)

    advise:

    1. try your code on your IDE, but calling it 2 times in a row.
    2. then you can close the issue (the problem is most likely in your code, not in the kata)
    3. this might help
  • Custom User Avatar

    It's like a magic ))) now i passed all test except random. Most likely i change something and and now it work correct. Anyway thank you very much sir

  • Default User Avatar

    Hey @nestormanjk - no worries for language, it is 2nd language for most users also :)

    So from this screen shot, if I interpret the console log correctly it seems that the test your code is failing on is the last one in the console which is:

    attackers = [51,28,13,15,2,14,58,61]

    defenders = [95,47,42,53]

    The correct answer for this is false (I checked using the kata reference solution) but it seems your code is returning true (that's what the error message says): so can you check these inputs in your local computer also - do you get false on local machine?

  • Default User Avatar

    @nestormanjk you have to be more clear when asking questions, right now it's hard to read if you think there's a problem with the tests or with your solution/kata logic.

    I checked all the 3 cases you gave, and the correct answer (according to Python reference solution) is True for all of them.

    Maybe you are reading Tests/error messages incorrectly? :

    Depending on which language you are working in (this is why you need to state it in your question) - if your error message is something like: "Expected false to equal true" it usually means that you are returning false and the correct answer is true for those inputs.

    To be 100% sure before debugging more: first try the same tests in your local computer - put attackers [1, 5, 3] defenders[2, 2, 6, 8] into your solution and see if it returns true (correct answer) or false (incorrect answer) ??

  • Custom User Avatar

    Thanks benjaminzwhite. :-)

  • Default User Avatar

    Hi @romanBryndzak - I copied this test and note that 492 and 540 is just the sum of the respective arrays: are you just comparing the sum of the 2 arrays to find your answer??

    If so, that is not what the kata is asking for (it would be a bit easy if so...). Re-read the description, the condition is more complex than that: you have to compare element-by-element, determine winner of each "battle", then add up the number of survivors etc.

  • Custom User Avatar

    Hi, people. I have a problem in start test.
    assert.strictEqual(hasSurvived([32, 65, 21, 83, 85, 7, 71, 45, 20, 63], [83, 44, 38, 55, 84, 80, 58, 20, 4, 74]), false);
    });
    This test expects false but the result is 492 and 540, so this is true. Yes?

  • Default User Avatar

    Thank you :D

  • Custom User Avatar

    Approved by someone

  • Default User Avatar

    I have run its reference solution against a full compliment of tests extracted from the Python version. If there is any problem with the translation, I will be sure to see that they are promptly rectified. :0

  • Default User Avatar

    Thanks for translating, I can't review the translation since I don't know about C but it seems to be working fine so I'll approve it if no one else reviews it :)

  • Default User Avatar

    You can try training again and submitting the solution again, don't know if it'll work. But if your concern is whether or not it counts as completed, it does count, you wouldn't be able to see other people's answers if you didn't complete it, also it appears as completed in your profile.

  • Loading more items...