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.
No. [0, 2] is the optimal solution but in this Kata you're supposed to use the greedy solution. Computing the optimal solution is much more complex.
item[0] gives the highest value per size (80 / 60 = 1.33333), so the greedy solution will grab as many of those as it can, which is 1. The greedy solution won't even try to grab any of item[1] until it can't fit any more of item[0] in its bag, and it's not clever enough to take item[0] back out so it could fit 2 of item[1], which would be a higher total value. Therefore the greedy solution will be [1, 0].
@hehe_3434 your function probably sorts the array of items. Don't do that, or create a copy of it first... the test expects it to still be in the same order after returning from your function.
me : 113 [ [ 95.5, 73.5 ], [ 171.9, 28.7 ], [ 27.2, 196.6 ] ] Expected: [4, 0, 0], instead got: [0, 0, 4].I don't know why