Largest area under histogram

wrong output


mistakes

  1. insert i instead of element
  2. before poping the element store the element
       st=s.top();
        s.pop();
  1. correct formula is
area=arrr[i]*(st-i+1);

still wrong output

your code has many mistakes


this is modified code

it is showing segmentation falt

max array size inside function is 10^6 and globally 10^8 only

change size of array

still showing segmentation fault

you have not change the size of array
as explained above

i have updated it in the marked function

it is of the order 10^9

make it 10^7

look at constraints carefully

Constraints
1<=N<=10^6
Height of each bar in histogram <= 10^9

max size of array is 10^6

still showing the error

try again this code after changing size of array is running for me