Question : Given a link list of integers delete all nodes which have value smaller than the value of any following node.
**Example :**7 4 5 2 3 6
**Output : ** 7 6
Solution:
The solution is to :
1. Reverse the list
6 3 2 5 4 7
2. Delete all the elements which are below the max-till-now element.
eg. max-till-now=6….Delete all the elements below 6…till you find another max element = max-till-now = 7
6 7
3. Reverse the left out list again
7 6