https://ide.geeksforgeeks.org/lqBVlhRgnw----why my code is showing null pointer exception and also please check if there is any error in my logic
Intersection point two linked list problem
@AbhishekAhlawat1102,
I have edited your code: https://ide.geeksforgeeks.org/Ps5FvkaRGK
The error was that you were not adding the input elements instead adding elements from (0 to n).
But your code will still give error for the test case when there is no intersection element. You have to print -1 for that.
Example:
your code will give nullpointer error for:
2
1 2
2
3 4
Also, a lot of your code and previous codes look very similar to solutions given on geeksforgeeks. It is advisable to solve questions on your own and plagiarism is taken very seriously.
for this code i have used hint video provided in the course not geeks for geeks although i have used their ide to post the doubt
for linked list implementation i have used code provided in earlier challenges of linked list in course itself