Question 1
A company manages a network of n servers to handle incoming requests. Each server can handle a specified number of requests represented by an array, serverCapacity
. However, the actual incoming requests for each server, represented by incomingRequests
, may exceed the capacity of some servers, leading to potential overload and performance degradation.
To optimize load distribution and ensure efficient server utilization, the company plans to double the capacity of any k servers. The task is to determine the maximum total number of requests that can be handled by all the servers after implementing these changes.
Example
Input:
n = 4
serverCapacity = [10, 4, 3, 7]
incomingRequests = [3, 10, 4, 5]
Output:
20
Explanation:
The company decides to double the capacity of k = 2
servers.
If the second and third server capacities are doubled, the number of requests served is 3 + 8 + 4 + 5 = 20
.
There is no way to handle all 10 requests with the second server.
Hence, the answer is 20.
Function Description
Complete the function getMaxRequests in the editor below.
getMaxRequests takes the following parameter(s):
int serverCapacity[n]
: the capacity of each serverint incomingRequests[n]
: the number of incoming requests for each serverint k
: the number of servers whose capacity is doubled
Returns:
long
: the maximum number of total requests that can be handled by all the servers after modifications
Constraints
- 1 ≤ n ≤ 100,000
- 1 ≤ k ≤ n
- 1 ≤ serverCapacity[i], incomingRequests[i] ≤ 1,000,000,000
Question 2
Complete a website layout application with the following UI.
Demo:
Task:
Design and implement a layout for a website card that matches the provided design.
我们长期稳定承接各大科技公司如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.