The first and the only line of the input contains the elements of the singly linked list separated by a single space and terminated by -1. Hence, -1 would not be a list element.
Print a single integer denoting the inversion count of the given linked list.
You don't need to print the output, it has already been taken care of. Just implement the given function.
0 <= L <= 10^5
-10^9 <= data <= 10^9 and data != -1
Where L is the number of nodes in the linked list and 'data' is the node value of the linked list.
Time Limit: 1 sec
Max Prefix
Merge Two Sorted Arrays Without Extra Space
Delete Nodes On Regular Intervals
Add One To Linked List
Sort 0s, 1s, 2s