data_structures.stacks.stock_span_problem

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 span of stock’s price for all n days.

The span Si of the stock’s 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.

Attributes

S

price

Functions

calculation_span(price, s)

print_array(arr, n)

Module Contents

data_structures.stacks.stock_span_problem.calculation_span(price, s)
data_structures.stacks.stock_span_problem.print_array(arr, n)
data_structures.stacks.stock_span_problem.S
data_structures.stacks.stock_span_problem.price = [10, 4, 5, 90, 120, 80]