注册一亩三分地论坛,查看更多干货!
您需要 登录 才可以下载或查看附件。没有帐号?注册账号 
x
7/7 做的OA,兩題分享,求加米! 看不到其他公司面經
Question 1
Amazon operates numerous warehouses, with each warehouse i holding inventory units of a particular product. You and your co-worker are responsible for dispatching these items to fulfill customer orders, following a specific process:
- When dispatching from warehouse i, you begin by reducing the inventory of the ith warehouse by dispatch1 units.
- After your dispatch, your co-worker reduces the inventory by dispatch2 units.
- This process repeats until the inventory of the ith warehouse reaches zero or becomes negative (i.e., inventory[i] <= 0).
- For every warehouse that is emptied during your dispatch, you and your co-worker collectively earn 1 credit.
Your co-worker has the option to skip their turn, but they can only do this a limited number of times, defined by skips.
Your task is to determine the best strategy to maximize the total credits that both you and your co-worker can earn together.
Example 1n = 6
inventory = [10, 6minimum time is 1.
Sample Case 1
password: "bcdb" (n = 4)
attackOrder: [2, 4, 1, 3]
m: 10
Total Substrings: (4 * 5) / 2 = 10
Function Description
Complete the functionin the editor below. has the following parameters:- string password: the initial password
- int attackOrder[n]: permutation array of integers [1, 2, ..., n], the attack order of the virus
- int m: the recoverability parameter
Return- int: the minimum time after which the password becomes irrecoverable.
Constraints - 1 ≤ n ≤ 8 * 10^5
- String password consists of lowercase English characters.
- 1 ≤ attackOrder[i] ≤ n
- 0 ≤ m ≤ n * (n + 1) / 2
|