Delete nodes having greater value on right

Problem description:

Given a singly linked list, remove all the nodes which have a greater value on right side.
Input:
You have to complete the method which takes 1argument: 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.
Output:
Your function shouldreturn a pointer to the linked list in which all nodes which have a greater value on right side are removed.

Problem Link

 

Leave a Reply

Your email address will not be published. Required fields are marked *