Find the greater element

https://ide.codingblocks.com/s/216471 it is giving segmentation error

hey @Learning_bunny where are you printing “-1” .keep a var as -1 and when u find ans,update or else just print -1. also try to use stack for better complexities

ok but why segmentation error

@Learning_bunny
your code gives no segmentation error ,but if u ant to know about it refer to this https://www.geeksforgeeks.org/core-dump-segmentation-fault-c-cpp/

i dont want to know about this but when i run my code on cb ide it is giving segmentation error thats why i am asking you

@Learning_bunny do this .it doesnt show any segmentation error for me