OA VO support

Amazon OA – OA代写 – hackrank – chime – part1

Question 1: Inventory Management System

Amazon's software developers are working on enhancing their inventory management system with a new feature. The goal is to analyze an array of n products, where the price of the i-th product is given by prod_price[i]. The objective is to determine the minimum number of price adjustments needed to ensure that the Amazon pricing algorithm yields the same price for the sums of all subarrays of length k within the array prod_price.

Price adjustment operations can be performed as follows:

  • Modify any number of values in the array prod_price[i] to any positive integer.

Given the array prod_price and a positive integer k, find the minimum number of changes required so that the sum of elements in all subarrays of length k is equal.

Note:

  • A subarray is a contiguous segment of an array.

Example: Given,

n = 4, prod_price = [5, 7, 7, 8], k = 2

Output:

The minimum number of changes required is 1.

Question 2: Array Generator Service

Your project team needs to work closely with a group of software testers. They have requested that your team create an array generator service to assist with testing software functionality.

Its input parameters are:

  1. arr[n]: contains n positive integers.
  2. state: is a string that contains n characters.
    • Each character is a '0' or '1'.
    • If state[i]='1', arr[i] is available.
    • If state[i]='0', arr[i] is blocked.

To create an integer array S, the following operation is performed exactly m times. S is initially empty:

  • Choose any arr[i] that is available, that is, where state[i]='1', the same element can be chosen any number of times.
  • Append the value in arr[i] to S.
  • For all state[i]='0' such that state[i-1]='1', change state[i] to '1'. For example, if state = '0100101' before the operation, it equals 0110111 after the operation.

Find the lexicographically largest sequence S that can be obtained after m operations.

Note:

  • A sequence x of length m is lexicographically larger than sequence y of length m if there exists such i (0 <= i < m), that x[i] > y[i], and for any j (0 <= j < i), x[j] = y[j].

Example: Input:

arr = [4, 5, 6, 3], state = "1100", m = 5

Output:

The lexicographically largest sequence is [6, 5, 5, 4, 4].

CSOAhelp长期稳定承接各大科技公司如TikTok、Google、Amazon等的OA笔试代写服务,确保满分通过。如有需求,请随时联系我们。

CSOAhelp 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 *