in the line 15 of the code where we have used ternary if else. shouldn’t the condition be betterday=s.empty()?day:s.top(); because if there is no value greater than a day’s stock then then the span should be zero for that day. But according to this condition the span will be the index of that day in the array.