Checks if a list has duplicates Reference: https://www.geekality.net/2010/01/19/how-to-check-for-duplicates/