Wrong ans coming

hi @G_rahil

problem is with

        int better_day=s.empty()?0:s.top();
        int span=(i-better_day);

correct one is

  int span=s.empty()?(i+1):(i-s.top());

when stack is empty means the current value is greatest in array till now so its span is i+1
otherwise it is (i-s.top())

modified Code