Name Deduplication
Description:
Given a list of names, remove the duplicate names. Two name will be treated as the same name if they are equal ignore the case.
Return a list of names without duplication, all names should be in lowercase, and keep the order in the original list.
Example
Given:
[“James”, “james”, “Bill Gates”, “bill Gates”, “Hello World”, “HELLO WORLD”, “Helloworld”]
return:
[“james”, “bill gates”, “hello world”, “helloworld”]
Code:
class Solution:
"""
@param names: a string array
@return: a string array
"""
def nameDeduplication(self, names):
# write your code here
for i in range(len(names)):
names[i] = names[i].lower()
return list(set(names))