Deleting a node in singly linked list if it is less than any of the successor nodes

Hi, try with 1,7,0,10. output must be 10. but your…

Unknown - Jun 6, 2012

Hi,
try with 1,7,0,10.
output must be 10.
but your algorithm outputs wrong answer

it seems that algo is correct..
1,7,0,10
reverse

10 0 7 1

max_till_here= 10

0 < 10 delete 0

left : 10 7 1

7 < 10 : delete 7

1 < 10 : delete 1

output : 10


See also