my code is not giving any output ,
logic seems to be correct .
please check what are the bugs
Stock span problem
There are two mistakes in your code:
- You are not taking input of value of n (cin>>n).
- Where is the โelseโ to the first โifโ in you function stockspan.
Please feel free to ask any doubts here, but try debugging your codes yourself. We would love to debug them for you, but it will only deprive you of the satisfaction, and experience you gain by debugging your own codes.
1 Like
ooh my bad . i was not taking input n and loop was running on garbage n in main function