# Amazon Online Assessment (OA) 2021 - Turnstile | Hackerank SHL

Warehouse workers carrying the goods arrive at the loading dock at different times. They form two queues, a "loading" queue and an "unloading" queue. Within each queue, the workers are ordered by the time they arrive at the dock.

When a worker arrives at the loading dock, if no other worker is at the dock at the same time, then the worker can use the dock.

If a "loading" worker and an "unloading" worker arrive at the dock at the same time, then we decide who can use the dock with these rules:

Return an array of the time (in minute) each worker uses the dock.

### Examples

#### Example 1:

##### Input:

time = `[0, 0, 1, 6]` direction = `[0, 1, 1, 0]`

##### Output:

`[2, 0, 1, 6]`

##### Explanation:
• At time `0`, worker `0` and `1` want to use the dock. Worker `0` wants to load and worker `1` wants to unload. The dock was not used in the previous minute, so worker `1` unload first.
• At time `1`, workers `0` and `2` want to use the rock. Worker `2` wants to unload, and at the previous minute the dock was used to unload, so worker `2` uses the dock.
• At time `2`, worker `0` is the only worker at the dock, so he uses the dock.
• At time `6`, worker `3` arrives at the empty dock and uses the dock.

We return `[2, 0, 1, 6]`.

## Title

### Script

Lorem Ipsum is simply dummy text of the printing and typesetting industry. `Lorem` `Ipsum` has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book.

Contrary to popular belief, `Lorem` `Ipsum` is not simply random text.

``````  >>> a = [1, 2, 3]
>>> a[-1]
3``````