亚马逊笔试真题 – OA代写 – Amazon 90-Minute OA Unveiled – Amazon Oa Amazon 90分钟OA大揭秘

亚马逊的OA分成2个部分,首先是限时90分钟的coding算法题,随后是一系列的与工作性格相关的选择题,这次我们一起来看看前面的算法部分吧。

The Amazon OA is divided into two parts. First, there is a 90-minute timed coding algorithm section, followed by a series of work-related personality questions. This time, let’s take a closer look at the algorithm section.

1. Code Question 1:

Data analysts at Amazon are studying the trends in movies and shows popular on Prime Video to enhance user experience.

They have identified the best critic-rated and the best audience-rated web series, represented by integer IDs series1 and series2. They also define the watch score of a contiguous period of some days as the number of distinct series watched by a viewer during that period.

Problem: Given an array watch_history, of size n, that represents the web series watched by a viewer over a period of n days, and two integers series1 and series2, report the minimum watch score of a contiguous period of days in which both series1 and series2 have been viewed at least once. If series1 and series2 are the same value, one occurrence during the period is sufficient.

Example:

n = 5
series1 = 1
series2 = 2
watch_history = [1, 3, 2, 1, 4]

The contiguous periods of days in which series1 and series2 have been viewed at least once are:

Period of DaysWatch Score (Distinct series watched)
[1, 3, 2]3
[3, 2, 1]3
[2, 1]2
[1, 3, 2, 1]3
[1, 3, 2, 1, 4]4

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

getMinScore has the following parameters:

  • int watch_history[]: The watch history of a viewer over n days.
  • int series1: ID of the best critic-rated web series.
  • int series2: ID of the best audience-rated web series.

Returns:

  • The minimum watch score of a contiguous period of days in which series1 and series2 have been viewed at least once.

2. Code Question 2:

Amazon’s database doesn’t support very large numbers, so numbers are stored as a string of binary characters, '0' and '1'. Accidentally, a '!' was entered at some positions, and it is unknown whether they should be '0' or '1'.

The string of incorrect data consists of the characters '0', '1', and '!' where '!' is the character that was entered incorrectly. '!' can be replaced with either '0' or '1'. Due to some internal faults, some errors are generated every time '0' and '1' occur together as '01' or '10' in any subsequence of the string. It is observed that:

  • The number of errors a subsequence '01' generates is x.
  • The number of errors a subsequence '10' generates is y.

Problem: Determine the minimum total errors generated. Since the answer can be very large, return it modulo 109+710^9 + 7109+7.

Example:

errorString = "101!1"
x = 2
y = 3

If the '!' at index 3 is replaced with '0', the string becomes "10101". The number of times the subsequence '01' occurs is 3 at indices (1, 2), (1, 4), and (3, 4). The number of times the subsequence '10' occurs is also 3 at indices (1, 2), (1, 3), and (3, 4). The total number of errors is 3 * x + 3 * y = 6 + 9 = 15.

The minimum number of errors is min(9, 15) % (10^9 + 7).

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

getMinErrors has the following parameters:

  • string errorString: The erroneous string containing '0', '1', and '!' characters.
  • int x: The error count for subsequence '01'.
  • int y: The error count for subsequence '10'.

Returns:

  • The minimum number of errors.

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