Not able to resolve the errors
@Shivam_balwani
your code is correct and passes all the test cases 
try to test it with input as
1 2 3 -1
4 2 3 -1
not the one given,
Consider these linked lists :
1 -> 2 -> 3 -> null

4
(This is not the actual input that will be provided but rather a description of it)
Hope this helps 