ide- https://ide.codingblocks.com/s/247869
i tried to code but it is not working could you please have look at my code and tell what’s wrong in it
Code not working
can anyone look at it
Pls use the following approach in your code as :
long long int max=0;
long long int step_area;
long long int tp;
stacks;
long long int i=0;
while(i<N)
{
if(s.empty() || ar[s.top()]<=ar[i])
{
s.push(i++);
}
else
{
tp=s.top();
s.pop();
if(s.empty())
{
step_area=ar[tp]i;
}
else
if(!s.empty())
{
step_area=ar[tp](i-s.top()-1);
}
if(step_area>max)
{
max=step_area;
}
}
}
while(!s.empty())
{
tp=s.top();
s.pop();
if(s.empty())
{
step_area=ar[tp]i;
}
else
if(!s.empty())
{
step_area=ar[tp](i-s.top()-1);
}
if(step_area>max)
{
max=step_area;
}
}
return max;
}