Ad
  • Custom User Avatar

    to answer the question of language, it is cpp

    closing: this is straight up wrong answer with all relevant information being present in the failure message. If it was tested to say 0 locally I would chalk that up to different iteration order of unordered_map

    it does however indicate weak tests. the bug they have is that they use 0 as a default value instead of eg. -1, and after setting the count to 0, they then overwrite it, mistaking it for the default

  • Custom User Avatar

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

  • Custom User Avatar

    .

  • Custom User Avatar

    It is unlikely that the same test case fails here and passes on your end. What is far more likely is that you are not running the failing test and/or not comparing the result correctly.

    I will close this issue as it does not demonstrate a problem. Failing a test is not an issue with the kata.

    My first guess without looking at your code (too lazy to go solve it in java) is that you're modifying the input. A function should not have any side effects other than what it is expcilitly meant to do - when the caller lends you some mutable data to look at, it is not at all ok to destroy that data.

  • Custom User Avatar

    Java here,

    The running code on my IDE is working but the test button sometimes shows errors and sometimes doesn't. When I try to attempt after getting all done somehow without changing the code, one or two failing cases(randomly with the same code) comes up but when I try them on my IDE it works fine.

    recipe = ("oil": 300, "flour": 1500, "sugar": 200, "eggs": 1)
    available =("oil":21000,"flour": 5000,"sugar": 1200,"eggs": 5, "milk": 200,"cream": 1000);