OA VO support

Welcome to The Amazon Coding Challenge – OA代写 – OA writing proxy

Test duration: 90 mins
No. of questions: 2

Code Question 1

Some developers at Amazon are building a prototype for a simple rate-limiting algorithm. There are n requests to be processed by the server represented by a string requests where the ith character represents the region of the ith client. Each request takes 1 unit of time to process. There must be a minimum time gap of minGap units between any two requests from the same region.

The requests can be sent in any order and there can be gaps in transmission for testing purposes. Find the minimum amount of time required to process all the requests such that no request is denied.

Example
Suppose n = 6, requests = "aaabbb" and minGap = 2.

The requests can be sent in the order "ab_ab_ab", where "_" represents that no request was sent. Here, the minimum time gap between two requests from the same region is minGap = 2. The total time taken is 8 units.

Function Description:
Complete the function getMinTime in the editor below.

getMinTime has the following parameters:

  • int n: the number of requests
  • string requests: the regions of requests to be processed
  • int minGap: the minimum gap between requests from the same region

Returns:

  • int: the minimum time required to process all the requests

Constraints:

  • 1 ≤ length of requests ≤ 10^5
  • 0 ≤ minGap ≤ 100
  • It is guaranteed that requests contain lowercase English characters only.

Sample Input for Custom Testing:

STDIN   FUNCTION
5 -> PnL[] size n = 4
1 -> PnL = [1, 1, 1, 1]
1
1
1
1

Sample Output:
2

Explanation:
There are multiple possible PnLs such as [1, -1, -1, 1], [-1, 1, -1, 1], [-1, 1, 1, -1], etc. However, it is optimal to modify the PnL to be [1, 1, -1, 1, -1] or [1, 1, -1, -1, 1].

Code Question 2

You are analyzing the market trends of Amazon stocks. An AWS financial service model returned an array of integers, PnL (Profit and Loss), for your portfolio representing that in the ith month, you will either gain or lose PnL[i]. All reported PnL values are positive, representing gains.

As part of the analysis, you will perform the following operation on the PnL array any number of times:

  • Choose any month i (0 ≤ i < n) and multiply PnL[i] by -1.

Find the maximum number of months you can afford to face a loss, i.e., have a negative PnL, such that the cumulative PnL for each of the n months remains strictly positive, i.e., remains greater than 0.

Note:
The cumulative PnL for the ith month is defined as the sum of PnL from the starting month up to the ith month. For example, the cumulative PnL for PnL = [3, -2, 5, -6, 1] is [3, 1, 6, 0, 1].

Example
Consider n = 4, and PnL = [5, 3, 1, 2].

Some of the possible arrays after performing the given operation some number of times:

Modified PnLCumulative PnLNumber of negativesIs ValidComments
[5, -3, -1, 2][5, 2, 1, 3]2YesThe operation was performed on the second and third months (bold). All the cumulative PnL are positive.
[5, -3, -1, -2][5, 2, 1, -1]3NoThe last cumulative PnL is negative, hence not valid.
[5, -3, 1, -2][5, 2, 3, 1]2YesAll the cumulative PnL are positive.
[-5, 3, 1, 2][-5, -2, -1, 1]1NoThe cumulative PnL for the first three months is negative.

Function Description:
Complete the function getMaxNegativePnL in the editor below.

getMaxNegativePnL has the following parameter(s):

  • PnL[]: an array of integers

Constraints:

  • 1 ≤ n ≤ 10^5
  • 1 ≤ PnL[i] ≤ 10^9

我们长期稳定承接各大科技公司如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.

One thought on “Welcome to The Amazon Coding Challenge – OA代写 – OA writing proxy

Leave a Reply

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