Ad
  • Custom User Avatar

    I'm having the exact same problem and I really can't understand why the lift stops at floor 3 at the end.

    SO the case is:

    Capacity: 4
    
    4: [2]
    3: [4, 1, 0, 4]
    2: [3, 4, 4, 4]
    1: [0, 4]
    0: [4, 3]
    

    Lift Stops at 0 - [4, 3] in the lift
    Lift Stops at 1 - [4, 3, 4] in the lift (queue at floor 1: [0])
    Lift Stops at 2 - [4, 3, 4, 3] in the lift (queue at floor 2: [4, 4, 4])
    Lift Stops at 3 - [4, 4, 4, 4] in the lift (queue at floor 3: [1, 0])
    Lift Stops at 4 - [2] in the lift (queue at floor 4: [])
    Lift Stops at 3 - [2, 1, 0] in the lift (queue at floor 3: [])
    Lift Stops at 2 - [1, 0] in the lift (queue at floor 2: [4, 4, 4])
    Lift Stops at 1 - [0, 0] in the lift (queue at floor 1: [])
    Lift Stops at 0 - [] in the lift (queue at floor 0: [])
    Lift Stops at 2 - [4, 4, 4] in the lift (queue at floor 2: [])
    ************* WHY IS IT SUPPOSE TO STOP AT FLOOR 3 HERE ****************
    Lift Stops at 4 - [] in the lift (queue at floor 4: [])
    Lift Stops at 0 - [] in the lift (queue at floor 4: [])

    Can someone tell me why my logic above is wrong. I'm going crazy on this