runtime error sigsegv plz help

why is it giving sigsegv runtime error??
ques. link :
solution link :

It might be because of invalid memory reference or segmentation fault. Probably you are accessing some illegal memory location.

Can u tell me exactly where is the code going wrong as i m unable to identify it??