We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent dba8eec commit ad4a9abCopy full SHA for ad4a9ab
strings/remove_duplicate.py
@@ -6,7 +6,7 @@ def remove_duplicates(sentence: str) -> str:
6
>>> remove_duplicates("Python is great and Java is also great")
7
'Java Python also and great is'
8
"""
9
- return " ".join(sorted(set(sentence.split())))
+ return " ".join(list(OrderedDict.fromkeys(sentence.split())))
10
11
12
if __name__ == "__main__":
0 commit comments