hello @vageesha
please mention the input for which it is giving seg fault
check now->
1 2 -1 -1 3 -1 -1 2 3
check my last response