Welcome to Amazon Student Programs Coding Challenge – 一亩三分地 – 亚马逊 – OA代写 – OA ghost writing -OA help

Imagine you're a seller on Amazon, specializing in eco-friendly home products. Each of your items is rated by customers based on its quality and environmental impact.

The overall qualityScore of your products is determined by the maximum possible sum of consecutive ratings.

To improve the qualityScore of your products and attract more customers, you are given with an integer impactFactor and the following two strategies:

  1. Amplify Ratings: Select a contiguous segment of ratings and amplify them by multiplying each rating in that range by impactFactor.
  2. Adjust Ratings: Select a contiguous segment of ratings and adjust them by dividing each rating in that range by impactFactor.

Your task is to determine the maximum possible qualityScore for your eco-friendly products after applying exactly one of these strategies.


Note:

When applying the second strategy i.e., Adjust Ratings:

  • For dividing positive ratings, use the floor value of the division result.
  • For dividing negative ratings, use the ceiling value of the division result.

Example:
Given ratings = [4, -5, -7, 1], and impactFactor = 2.
If we choose to apply the second strategy with segment [2, 5] (Assuming 1-based indexing), then modified ratings = [4, ceil(-5 / 2), floor(-7 / 2), floor(1 / 2)] = [4, -2, -3, 0].


Example:

Input:

  • n = 5
  • ratings = [5, -3, -3, 2, 4]
  • impactFactor = 3

Explanation:

Let’s try both the strategies with different contiguous ranges to get the maximum qualityScore:

StrategySegment (1-based indexing)Modified RatingsqualityScore
1[1, 1][5 * 2, -3, -3, 2, 4]10
2[2, 3][5, ceil(-3 / 2), ceil(-3 / 2), 2, 4]9
1[4, 5][5, -3, -3, 2 * 2, 4 * 2]12

Conclusion:

If we perform the first strategy on the subsegment [4, 5] (1-based indexing), we get the ratings = [5, -3, -3, 4, 8] with a qualityScore of 12, which is the maximum qualityScore. Hence, the answer is 12.


Function Description:

Complete the function calculateMaxQualityScore in the editor below.

Function Signature:

public static long calculateMaxQualityScore(int impactFactor, List<Integer> ratings);

Parameters:

  • int impactFactor: the value used in the strategies to amplify or adjust ratings.
  • int ratings[n]: an array representing the ratings of eco-friendly products.

Returns:

  • long: the maximum possible qualityScore of your eco-friendly products after applying exactly one of the strategies.


Input Format For Custom Testing:

Sample Input:

1  -> impactFactor = 1  
4 -> ratings[] size n = 4
-2
3
-3
-1

Sample Output:

3  

Explanation:

The initial qualityScore of the ratings is 3, and since impactFactor = 1, performing any of the strategies will not make any change, so this is the maximum qualityScore obtainable. Hence, the answer is 3.

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