On a nice day, Babai, a computer scientist, received back all 6 pairs of my and socks in a laundry basket. He needed to pair them up into pairs of same color for me.
Being a computer scientist, he wondered what would be a good way to sort them out. Can you help him by figuring out the faster way to sort these?
Swap and Go:
Throw into Buckets:
This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try
refreshing the page, (b) enabling javascript if it is disabled on your browser and,
finally, (c)
loading the
non-javascript version of this page
. We're sorry about the hassle.
The swap and go method will require multiple iterations of checking each sock to sort them into a pile of blue socks and a pile of red socks that can easily be paired.
Whereas the throw into buckets method only requires one iteration of checking each sock to sort them into blue and red.
Therefore the throw into buckets method is more efficient.