Thursday, September 19, 2013

remove all the nodes which have greater value on right(Linked list)

remove all the nodes which have greater value on right(Linked list)

Given a singly linked list, remove all the nodes which have a greater
value on right side.
e.g.
input:
2--->4--->2--->1--->3--->0
then the output should be
4--->3--->0.
input:
30--->40--->50--->60
then the output should be
60

No comments:

Post a Comment