Welcome to Campus Hiring code Test 2024-2025 – OA ghost writing – OA 代写 – 北美秋招 – North America Fall Recruitment

1. Server Traffic Monitor
There is client-server architecture with n clients and one server. Each client starts its interaction with the server at the second start[i] and stops at the second end[i]. The maximum traffic is defined as the maximum number of concurrent interactions with the server.

Find the earliest time at which the maximum number of clients are interacting with the server.

Note: The endpoint is also included in the interaction.

Example
Suppose start = [1, 6, 2, 9] and end = [8, 7, 6, 10]

TimeConnectionActive Clients
1Client 1 Joined1
2Client 3 Joined1, 3
31, 3
41, 3
51, 3
6Client 2 Joined1, 2, 3
7Client 3 Left1, 2
8Client 2 Left1
9Client 1 Left and Client 4 Joined4
104
11Client 4 Left

The maximum number of concurrent interactions is 3, which happens first at the 6th second. Return 6.


Function Description
Complete the function getMaxTrafficTime in the editor below.

getMaxTrafficTime has the following parameters:

  1. INTEGER_ARRAY start
  2. INTEGER_ARRAY end

Returns

  • INTEGER: the earliest second at which the maximum number of clients are interacting with the server

Constraints

  • 1 ≤ n ≤ 100000
  • 1 ≤ start[i], end[i] ≤ 1000000000


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 ith 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 nth service is maximized.

Example
For instance, throughput = [4, 2, 7], scaling_cost = [3, 5, 6], and budget = 32.

To maximize the throughput of the final service, an optimal solution is:

Service IndexScale FromScale ToTimes ScaledCost per ScalingTotal Cost
0412236
12104520
2714166

When these units are applied in series, they generate a throughput of 10 units, the maximum possible throughput given the budget. Hence the answer is 10.


Function Description
Complete the function getMaximumThroughput in the editor below.

getMaximumThroughput has the following parameters:

  1. INTEGER_ARRAY throughput: the throughput generated by each of the n services
  2. INTEGER_ARRAY scaling_cost: the cost of scaling up a service one time
  3. INTEGER budget: the available money

Returns

  • LONG INTEGER: the maximum value of the throughput generated at the end of the composite service after scaling within the budget

Constraints

  • 1 ≤ n ≤ 100000
  • 1 ≤ throughput[i] ≤ 10000000
  • 1 ≤ scaling_cost[i] ≤ 200
  • 1 ≤ budget ≤ 1000000000000000000

CSOAhelp长期稳定承接各大科技公司如TikTok、Google、Amazon等的OA笔试代写服务,确保满分通过。如有需求,请随时联系我们。

CSOAhelp 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.

Leave a Reply

Your email address will not be published. Required fields are marked *