Ad
  • Custom User Avatar

    perhaps the description is a bit ambiguous indeed,
    something like:
    "The priority is that the space to insert the new barrels to be as small as possible."

    maybe it will get better

  • Custom User Avatar

    because the priority is to find the smallest space, if there is a space that fits but it is larger, the choice will be the smallest space

    in this case ['', '', '', '0', '', ''], the smallest space that fits is in indexes 4-5, the space in indexes 0-2 is bigger so they should not be put there

    in the case of the warehouse like this: warehouse = ['', '', '0', '0', '', ''], barrels = ['0', '0'], then the barrels must be inserted in position 0-1, because it is leftmost