The Stock Span Problem | C++

In this video, we are going to look at a tricky question of stack: stock span Description: The stock span problem is a financial problem where we have a series of n daily price quotes for a stock and we need to calculate the span of stocks price for all n days. The span Si of the stocks price on a given day i is defined as the maximum number of consecutive days just before the given day, for which the price of the stock on the current day is less than or equal to its price on the given day. For example, if an array of 7 days prices is given as {100, 80, 60, 70, 60, 75, 85}, then the span values for corresponding 7 days are {1, 1, 1, 2, 1, 4, 6}. Link: In this video, you’ll also learn about asymptotic notatio ... #ProgrammingKnowledge #Data_Structures_And_Algorithms #Data_Structures #algorithm #Algorithms #Algorithms_Tutorial #Data_Structures_Tutorial #Arrays #Strings #Stacks 20220819 GUO719_RZy0
Back to Top