use each_with_object to simply code


On another note:

     # Another (more efficient) approach is to order the linkedlist first,
     # then check every node against its "next" and that way detecting dups
     # is easy and fast, but then again, most sorting algorithms require
     # storing extra data temporarily.

could you give an example code?  I can't figure it out.