2. Code Question 2 The interns at Amazon were asked to review the company's stock value over a period. Given the stock prices of n months, the net price change for the i'll month is defined as the absolute difference between the average of stock prices for the first / months and for the remaining (n - /) months where ALL Is i <n. Note that these averages are rounded down to an integer. Given an array of stock prices, find the month at which the net price change is minimum. If there are several such months, return the earliest month.J Note: The average of a set of Integers here is defined as the sum of integers divided by the number of integers, rounded down to the nearest Integer, For example, the average of [1; 2, 3, 4] is he floor of (1 + 2 . 3-4) /1 = 2.5 and the floor of Examp stockPrice = FI. 3. 2: 31
M NEXT STEPS: Amazon Software D X HackerRank Question - Code Qu
+ C a hackerrank.com/test/c8ch1cc1bb0/questions/9606
th Om left
2. Code Question 2
The interns at Amazon were asked to review the
company's stock value over a period. Given the
stock prices of n months, the net price change for
the i'll month is defined as the absolute difference
between the average of stock prices for the first /
months and for the remaining (n - /) months where
ALL
Is i <n. Note that these averages are rounded
down to an integer.
Given an array of stock prices, find the month at
which the net price change is minimum. If there are
several such months, return the earliest month.J
Note: The average of a set of Integers here is
defined as the sum of integers divided by the
number of
integers, rounded down to the nearest
Integer, For example, the average of [1; 2, 3, 4] is
he floor of (1 + 2 . 3-4) /1 = 2.5 and the floor of
Examp
stockPrice = FI. 3. 2: 31




0 కామెంట్లు