This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// C++ linear time solution for stock span problem | |
#include <iostream> | |
#include <stack> | |
using namespace std; | |
// A stack based efficient method to calculate | |
// stock span values | |
void calculateSpan(int price[], int n, int S[]) | |
{ | |
// Create a stack and push index of first |