(migrated from Code Golf)
The question comes from the HackerRank problem Merge two sorted linked lists:
Sample Input
1 3 1 2 3 2 3 4Sample Output
1 2 3 3 4Explanation
The first linked list is: 1→3→7→Null
The second linked list is: 3→4→Null
Hence, the merged linked list is: 1→2→3→3→4→Null
I have two questions:
- How does the sample input correspond to the explanation section? There is no "7".
- In the explanation,
"The first linked list is: 1->3->7->Null"
but in the merged list there is no "7". Why does "7" disappear?
>Solution :
It’s a mistake. The first linked list is: 1→2→3→Null