Ad
  • Default User Avatar
  • Custom User Avatar

    The C++ randomized tests are ridiculously more difficult than the Javascript ones. Here are a few randomized tests from the Javascript cases:

    money=2962, coins=[342, 381, 358, 400]
    money=0, coins=[14, 482, 58]
    money=1504, coins=[376]
    money=0, coins=[108, 358, 319, 439]
    

    and the madness that are the randomized C++ cases:

    money=45290, coins=[1, 2, 2052, 2414, 3758, 3768, 4685, 6607, 6852, 9886, 11599, 12309, 12537, 14983, 19645, 21142, 21952, 22199, 25886, 26096, 26608, 28288, 29523, 30689, 36574, 37546, 39867, 40640, 41033, 43250]
    money=71905, coins=[1, 2, 1091, 3875, 8351, 10746, 11519, 14011, 22480, 22954, 23537, 26308, 30694, 35073, 40862, 41930, 42306, 47965, 50558, 54438, 57510, 57864, 61605, 63530, 67173, 67536]
    money=71119, coins=[1, 2, 2473, 24198, 24931, 31298, 39847, 42517, 50857, 54231, 59625, 66036]
    

    I ended up implementing an optimization just for these 1, 2, big_number, ..., big_number cases, which funnily enough is enough to pass them (assuming that the rest of your code is somewhat efficient). Otherwise a recursive solution simply isn't performant enough.

  • Custom User Avatar
  • Custom User Avatar
  • Custom User Avatar

    You'll have to code a function getIngredients(recipes, final, amount)

    There's no amount parameter in the initial solution, and it seems no argument is ever provided for it in the tests.

  • Custom User Avatar

    Approved some time ago

  • Custom User Avatar

    Tests are not working properly, throw an error :
    ReferenceError: Test is not defined
    at /workspace/node/test.js:59:1
    ...

  • Default User Avatar

    'alr approved some time ago'

  • Default User Avatar

    I think for avoiding misundestanding you should clarify this moments, thank you :)

  • Custom User Avatar

    Duplicate issue.

  • Custom User Avatar

    onij [big]: sort by size, from smallest to biggest

    Test 61/100: onarij-ar onij

    expected [ { name: 'puppy', type: 'potion', color: 'purple', size: 20 },
      { name: 'lamp', type: 'potion', color: 'purple', size: 38 },
      { name: 'teardrop', type: 'furniture', color: 'red', size: 60 },
      { name: 'socks', type: 'clothing', color: 'yellow', size: 65 },
      { name: 'glass', type: 'furniture', color: 'green', size: 67 },
      { name: 'wand', type: 'potion', color: 'red', size: 70 },
      { name: 'socks', type: 'clothing', color: 'purple', size: 71 },
      { name: 'scarf', type: 'tool', color: 'orange', size: 95 },
      { name: 'plushie', type: 'clothing', color: 'green', size: 99 },
      { name: 'vest', type: 'furniture', color: 'red', size: 101 },
      { name: 'scarf', type: 'clothing', color: 'red', size: 105 } ]
      
      to deeply equal
      
      [ { name: 'wand', type: 'potion', color: 'red', size: 70 },
      { name: 'puppy', type: 'potion', color: 'purple', size: 20 },
      { name: 'lamp', type: 'potion', color: 'purple', size: 38 },
      { name: 'teardrop', type: 'furniture', color: 'red', size: 60 },
      { name: 'socks', type: 'clothing', color: 'yellow', size: 65 },
      { name: 'glass', type: 'furniture', color: 'green', size: 67 },
      { name: 'socks', type: 'clothing', color: 'purple', size: 71 },
      { name: 'scarf', type: 'tool', color: 'orange', size: 95 },
      { name: 'plushie', type: 'clothing', color: 'green', size: 99 },
      { name: 'vest', type: 'furniture', color: 'red', size: 101 },
      { name: 'scarf', type: 'clothing', color: 'red', size: 105 } ]
    

    The first value in the kata's shouldBe has a size greater than the next one.

  • Custom User Avatar
    Order by size:
    
    Actual:
    [ { name: 'puppy', type: 'potion', color: 'blue', size: 10 },
      { name: 'puppy', type: 'potion', color: 'blue', size: 13 },
      { name: 'lamp', type: 'animal', color: 'purple', size: 19 },
      { name: 'scarf', type: 'potion', color: 'green', size: 28 },
      { name: 'glass', type: 'animal', color: 'purple', size: 36 },
      { name: 'pillow', type: 'furniture', color: 'red', size: 37 } ]
    
    Expected:
    [ { name: 'pillow', type: 'furniture', color: 'red', size: 37 },
      { name: 'puppy', type: 'potion', color: 'blue', size: 10 },
      { name: 'puppy', type: 'potion', color: 'blue', size: 13 },
      { name: 'lamp', type: 'animal', color: 'purple', size: 19 },
      { name: 'scarf', type: 'potion', color: 'green', size: 28 },
      { name: 'glass', type: 'animal', color: 'purple', size: 36 } ]
    
  • Custom User Avatar

    The user's solution may be swapping elements with the same ordering thus failing sometimes, but there're not enough tests to catch this.

  • Custom User Avatar

    I slipped through the cracks with my own solution and confirmed this as an issue.

  • Custom User Avatar

    This is a random test from the reference solution:

     Test 98/100: onarij-ar onij niùn-ij
    expected
    [ { name: 'teardrop', type: 'clothing', color: 'blue', size: 60 },
      { name: 'wand', type: 'tool', color: 'blue', size: 16 },
      { name: 'glass', type: 'animal', color: 'colorless', size: 26 },
      { name: 'vest', type: 'potion', color: 'green', size: 35 },
      { name: 'glass', type: 'potion', color: 'red', size: 39 },
      { name: 'vest', type: 'animal', color: 'yellow', size: 45 },
      { name: 'socks', type: 'potion', color: 'blue', size: 66 },
      { name: 'pants', type: 'furniture', color: 'green', size: 67 },
      { name: 'lamp', type: 'furniture', color: 'yellow', size: 72 },
      { name: 'vest', type: 'tool', color: 'green', size: 96 },
      { name: 'plushie', type: 'potion', color: 'yellow', size: 102 }
    ]
    to deeply equal
    [ { name: 'teardrop', type: 'clothing', color: 'blue', size: 60 },
      { name: 'wand', type: 'tool', color: 'blue', size: 16 },
      { name: 'glass', type: 'animal', color: 'colorless', size: 26 },
      { name: 'vest', type: 'potion', color: 'green', size: 35 },
      { name: 'glass', type: 'potion', color: 'red', size: 39 },
      { name: 'vest', type: 'animal', color: 'yellow', size: 45 },
      { name: 'socks', type: 'potion', color: 'blue', size: 66 },
      { name: 'pants', type: 'furniture', color: 'green', size: 67 },
      { name: 'lamp', type: 'furniture', color: 'yellow', size: 72 },
      { name: 'vest', type: 'tool', color: 'green', size: 96 },
      { name: 'plushie', type: 'potion', color: 'yellow', size: 102 }
    ]
    

    Something's wrong. Not always, but sometimes, the sorting's wrong for onij.

    I haven't been able to figure out what, sorry.

  • Loading more items...