second thought .. i could iterate from the end of ...
# codereview
m
second thought .. i could iterate from the end of the list. and then can use the same approach as distinct