FastPrepFastPrep
Problem Brief

Server Investment 🐳

OA
See Tiktok online assessment and hiring insights

A network security administrator must protect networks at several locations from cyber-attacks.

Initially, the nth network has num_servers[i] servers, and money[i] funds allocated for security upgrades. To upgrade a server in the n^{th} network, it costs upgrade[i]. Selling a server adds sell[i] to available funds.

Formally, Given the arrays num_servers, money, upgrade, and sell, each with n integers, determine the maximum number of servers that can be upgraded to ensure optimal network security.

The result should be an array of n integers, where the ith integer represents the maximum number of upgraded servers for the ith network system.

1Example 1

Input
num_servers = [4, 3], money = [8, 9], sell = [4, 2], upgrade = [4, 5]
Output
[3, 2]
Explanation
Example 1 illustration
p.s. not very sure about the output. If you find it wrong, pls lmk! Many thx in advance! 🀝

Constraints

Limits and guarantees your solution can rely on.

Unknwon for nowww
public int[] maximizeUpgradedServers(int[] num_servers, int[] money, int[] upgrade, int[] sell) {
  // write your code here
}
Input

num_servers

[4, 3]

money

[8, 9]

sell

[4, 2]

upgrade

[4, 5]

Output

[3, 2]

Sign in to submit your solution.