Why is my code giving segmentation fault?


I have tried the stock span problem by making a pair in a stack

Hey Jatin, you have to reserve size for vectors as they are initially empty containers.
do it by
p.reserve(7)
and similarly for stock also.
Your answer will be incorrect (please correct your implementation)

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.