1. Server Traffic Monitor
In a client-server architecture with n clients and one server, each client starts interacting with the server at second start[i] and stops at second stop[i]. The maximum traffic is defined as the highest number of concurrent interactions with the server.
Determine the earliest time when the maximum number of clients are interacting with the server.
Note: The endpoint is also included in the interaction.
Example
Suppose start = [1, 3, 6, 2, 9] and stop = [8, 7, 6, 10, 10]
Time | Connection | Active Clients
--------------------------------------
1 | Client 1 Joined| 1
2 | Client 4 Joined| 1, 4
3 | Client 2 Joined| 1, 2, 4
4 | | 1, 2, 4
5 | | 1, 2, 4
6 | Client 3 Joined| 1, 2, 3, 4
7 | | 1, 2, 3
8 | Client 1 Left | 2, 3
9 | Client 5 Joined| 2, 3, 5
10 | Client 3 Left | 2, 5
2. Maximum Throughput
In our system, we have a pipeline consisting of data processing units, each with varying throughputs as represented by throughput[i]. These units are arranged in a series, requiring data to pass through each of them sequentially. Consequently, the total throughput of the pipeline is constrained by the unit with the smallest throughput, which becomes the bottleneck limiting the overall processing speed.
Each service can be scaled up independently, with the cost of scaling up the iᵗʰ service one unit equal to scaling_cost[i]. After scaling up a service x times, it can process throughput[i] * (1 + x) messages per minute.
Given the arrays throughput and scaling_cost, both of size n, and an integer budget representing the budget available, determine the optimal scaling configuration for the services such that the throughput generated by the nᵗʰ service is maximized.
Example
For instance,
throughput = [4, 2, 7],
scaling_cost = [3, 5, 6],
budget = 32
To maximize the throughput of the final service, an optimal solution is:
Service Index | Scale From | Scale To | Times Scaled | Cost per Scaling | Total Cost
--------------------------------------------------------------------------------------
0 | 4 | 12 | 2 | 3 | 6
1 | 2 | 10 | 4 | 5 | 20
2 | 7 | 8 | 1 | 6 | 6
我们长期稳定承接各大科技公司如TikTok、Google、Amazon等的OA笔试代写服务,确保满分通过。如有需求,请随时联系我们。
We consistently provide professional online assessment services for major tech companies like TikTok, Google, and Amazon, guaranteeing perfect scores. Feel free to contact us if you're interested.
