这次北美某大厂的OA火热开放中，限时90分钟，3道比较简单的算法题。我们一起来看看过去它的一些题目。

**Queued Seats**

For a bus going to Hackerland, there are infinite seats numbered from 1 to infinity, and n people are standing in a queue waiting to be seated. The ith person wants to be seated on the seat numbered arr[i]. The seats are allocated based on the following rules:

- The seats are allocated in the sequence of the queue i.e. the first person followed by the second person and so on.
- If the seat required by the person in the front of the queue is empty, they are allocated that seat and removed from the queue.
- If the seat required by the person in the front of the queue is occupied, the seat number required by them is incremented by 1 and they are pushed to the end of the queue.

Given a program or representation showing the seat numbers that the people in the queue want, find the final seat number allocated to each person in the queue.

**Example**

Given n = 5, arr[1, 2, 3, 2, 4], the seats are assigned in the following manner -

Queue | Seat Allocation | Action |
---|---|---|

[1(1), 2(2), 3(3), 2(4), 4(5)] | - | - |

[2(2), 3(3), 2(4), 4(5)] | 1:1 | Seat 1 is allocated to person 1 |

[3(3), 2(4), 4(5)] | 1:2 | Seat 2 is allocated to person 2 |

[2(4), 4(5)] | 1:1, 2:2, 3:3 | Seat 3 is allocated to person 3 |

[4(5)] | 1:1, 2:2, 3:3, 4:5 | Seat 4 is allocated to person 4 |

[5(4)] | 1:1, 2:2, 3:3, 4:5 | Seat 5 is allocated to person 5 |

The final answer is [1, 2, 3, 4, 5].

**Optimal Account Balancing**

You are given an array of transactions where transactions[i] = [from_i, to_i, amount_i] indicates that the person with ID = from_i gave amount_i $ to the person with ID = to_i.

Return the minimum number of transactions required to settle the debt.

**Example 1:**

**Input:**transactions = [[0,1,10], [2,0,5]]**Output:**2**Explanation:**- Person #0 gave person #1 $10.
- Person #2 gave person #0 $5.
- Two transactions are needed. One way to settle the debt is person #1 pays person #0 and #2 $5 each.

**Example 2:**

**Input:**transactions = [[0,1,10], [1,0,1], [1,2,5], [2,0,5]]**Output:**1**Explanation:**- Person #0 gave person #1 $10.
- Person #1 gave person #0 $1.
- Person #1 gave person #2 $5.
- Person #2 gave person #0 $5.
- Therefore, person #1 only need to give person #0 $4, and all debt is settled.

**Constraints:**

- 1 <= transactions.length <= 8

我们提供OA代写服务，代面试服务，面试辅助服务等。对于OA代写我们将确保你获得满分，联系我们立即进行预约。

We provide services for writing online assessments (OA), proxy interviews, and interview assistance. For the OA writing service, we will ensure that you achieve a perfect score. Contact us now to make an appointment.