GETTING segmentation fault

can u plz identify and solve my mistake

hello @premang
your code looks correct.
pls make sure u are giving input in correct order.

1 Like

this was the input that bhaiya had given
3 4 -1 6 -1 -1 5 1 -1 -1 -1

1 Like

oh thanks, it was input problem thanx. marking as solved