Why is my code giving segmentation fault?

https://ide.geeksforgeeks.org/mAnfjIvd6b

Hello @joker1

In this problem you are NOT allowed to use any other data structure other than Linked list i.e., Don’t use arrays to solve the problem.