Amazon OA – Amazon Coding Challenge – 亚马逊笔试真题 – OA writing 代写 – 面试辅助 – 代面试 – VO interview support

Amazon这一周的OA真题出来啦,无论是NG还是社招的同学,题库目测是一样的,除了以下2个算法题之外,还有part2一系列的选择题。

Amazon's OA exam questions for this week have come out. Whether it's NG or social recruitment students, the question bank looks the same. In addition to the following two algorithm questions, there are also a series of multiple-choice questions in Part 2.

Get Max Racers

HackerLand Sports Club wants to send a team for a relay race. There are n racers in the group indexed from 0 to n - 1. The ith racer has a speed of speed[i] units.

The coach decided to send some contiguous subsegments of racers for the race i.e. racers with index ii + 1i + 2 ..., j such that each racer has the same speed in the group to ensure smooth baton transfer. To achieve the goal, the coach decided to remove some racers from the group such that the number of racers with the same speed in some contiguous segment is maximum.

Given the array, racers, and an integer k, find the maximum possible number of racers in some contiguous segment of racers with the same speed after at most k racers are removed.

Function Description

Complete the function getMaxRacers in the editor.

getMaxRacers has the following parameter(s):

  1. int speed[n]: the speeds of the racers
  2. int k: the maximum number of racers that can be removed

Returns

int: the maximum number of racers that can be sent after removing at most k racers

Example 1:

Input:  speed = [1, 4, 4, 2, 2, 4], k = 2
Output: 3
Explanation: It is optimal to remove the two racers with speed 2 to get the racers [1, 4, 4, 4]. Each racer with speed 4 can now be sent as they are in a contiguous segment. A maximum of 3 racers can be sent for the relay race.

Constraints:

  • 1 ≤ n ≤ 3 * 10^5
  • 1 ≤ k ≤ n

Get Minimum Cost

In Amazon Go Store, there are nitems, each associated with two positive values a[i] and b[i]. There are infinitely many items of each type numbered from 1 to infinity and the item numbered j of type i costs a[i] + (j - 1) * b[i] units.

Determine the minimum possible cost to purchase exactly m items.

Function Description

Complete the function getMinimumCost in the editor.

getMinimumCost has the following parameters:

  1. 1. int a[n]: an array of integers
  2. 2. int b[n]: an array of integers
  3. 3. m: the number of items to purchase

Returns

long integer: the minimum cost

Example 1:

Input:  a = [2, 1, 1], b = [1, 2, 3], m = 4
Output: 7
Explanation: The optimal types to buy are- 1. Choose i = 1. This is the first purchase of this type of item, so j = 1. The first item costs a[1] + (1 - 1) * b[i] = 1 + (1 - 1) * 2 = 1. 2. Choose i = 2. Again, it is the first purchase of this type so j = 1. The second item costs 1 + (1 - 1) * 3 = 1. 3. Choose i = 0 which costs 2 + (1 - 1) * 1 = 2. 4. When a second unit of any type is purchased, j = 2 for that transaction. The costs of a second units of each item are: a. a[0] costs a[0] + (2 - 1) * b[0] = 2 + 1*1 = 3 b. a[1] costs 1 + 1*2 = 3 c. a[2] costs 1 + 1*3 = 4 d. Choose either a[0] or a[1] since they cost less. The total cost to purchase is 1 + 1 + 2 + 3 = 7.

Constraints:

  • 1 <= n <= 105
  • 1 <= a[i], b[i] <= 105
  • 1 <= m <= 105

Reference answer

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

Leave a Reply

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