Ad
  • Default User Avatar

    Without a specific python function, this was very confusing.

  • Custom User Avatar

    In the case where both elevators are equally distant from the called floor, choose the elevator to the right.

    Your code fails for (1 1 0). The distance of call to left&& right respectively is the same, so the answer should be right.

  • Custom User Avatar

    according to the instructions "the elevator should take the second call if it is closest to both calls AND if both floors are in the same direction for the elevator AND both calls are in the same direction even if it needs to change it's direction once to pick them both up." How is floor 5 closer to -7 than a lift at -4 moving downwards?

  • Custom User Avatar

    Am I missing something here?

    [5,-5,{"floor":-4,"direction":"down"},{"floor":-7,"direction":"down"}]: expected 'right right' to equal 'right left'

    Right is closer to both, both are in the same direction and it doesn't have to change direction

  • Custom User Avatar
  • Custom User Avatar

    changed to

    There is a building with 2 elevators ('left' and 'right') and a bunch of floors (both negative and positive).

  • Custom User Avatar

    Description is indecisive about how many floors exist: if the actual range of floors can be unbounded in both positive and negative ranges, the description shouldn't start with and 5 floors (0, 1, 2, 3, 4) and then invalidate this statement at the end of the description, that's just being nasty and unnecessarily misleading.

  • Custom User Avatar

    Thanks for your efforts.

  • Custom User Avatar

    Important notes added to the description

    Notes:
    - if one or both calls come from the same floor as an elevator, these are considered to be on the same side of the elevator
    - if an elevator is closest to both calls, but the conditions to take both calls are not met, pick call1
    
  • Custom User Avatar

    fixed

  • Custom User Avatar

    Updated to node 18 and error messages improved.

  • Custom User Avatar

    fixed

  • Custom User Avatar

    fixed

  • Custom User Avatar

    I've updated the ref sol and made some edge cases more clear in the description. Could you retry?

  • Custom User Avatar

    The ref sol does not take into account one caller being on the same floor as both being on the same side (up / down) of an elevator. I'll rework the ref sol. This will probably invalidate most if not all solutions.

  • Loading more items...