Complete the removeDuplicates() function which takes a list sorted in non-decreasing order and deletes any duplicate nodes from the list. The list should only be traversed once.
For example if the linked list is 11->11->11->21->43->43->60 then removeDuplicates() should convert the list to 11->21->43->60.
You have to complete the method which takes 1 argument: the head of the linked list .You should not read any input from stdin/console. There are multiple test cases. For each test case this method will be called individually.
Your function should return a pointer to a linked list with no duplicate element.
1<=size of linked lists<=50
Note: If you use "Test" or "Expected Output Button" use below example format.
2 2 4 5
2 2 2 2 2
2 4 5
Note:The Input/Ouput format and Example given are used for system's internal purpose, and should be used by a user for Expected Output only. As it is a function problem, hence a user should not read any input from stdin/console. The task is to complete the function specified, and not to write the full code.