Amazon oa recent question. Could any one solve this one?
Anonymous User
123

the price of amazon common stock is analyzed over a period of several months. a group of k consecutive months is said to be observable if no two months in the group have the same stock price. in other words, all the prices in the period are distinct. the sum of stock prices of an observable group of months is called the cumulative observable sum. given the price of amazon stock for n months, find the maximum possible cumulative observable sum among all the observable groups of months. if there is no observable group, return -1. example monthly stock prices are given as stockprice = [1, 2, 7, 7, 4, 3, 6], and the number of consecutive months to consider is k = 3.

Comments (2)