what is wrong in my code ?
Why isnt my one testcase passing?
for input
7
100 80 60 70 60 75 85
your output is
1 1 1 3 1 5 7
but correct output is
1 1 1 2 1 4 6
There two mistake in code
- condition you have use is wrong
correct condition is while(!s.empty()&& a[s.top()]<=currPrice){ - second is modified in code
Modified Code
i hope this help
if you have more doubts regarding this feel free to ask
if your doubt is resolved mark it as resolved from your doubt section inside your course