Next greater element

https://hack.codingblocks.com/practice/p/370/505

why run error?
@phantom

it stack probelm
check this simple sol


I have also used Stack approach.
Can you just the code. Please.