File tree Expand file tree Collapse file tree 2 files changed +6
-8
lines changed
Expand file tree Collapse file tree 2 files changed +6
-8
lines changed Original file line number Diff line number Diff line change 258258 * [ Scc Kosaraju] ( https://github.com/TheAlgorithms/Python/blob/master/graphs/scc_kosaraju.py )
259259 * [ Tarjans Scc] ( https://github.com/TheAlgorithms/Python/blob/master/graphs/tarjans_scc.py )
260260
261+ ## Greedy Method
262+ * [ Greedy Knapsack] ( https://github.com/TheAlgorithms/Python/blob/master/greedy_method/greedy_knapsack.py )
263+ * [ Test Knapsack] ( https://github.com/TheAlgorithms/Python/blob/master/greedy_method/test_knapsack.py )
264+
261265## Hashes
262266 * [ Chaos Machine] ( https://github.com/TheAlgorithms/Python/blob/master/hashes/chaos_machine.py )
263267 * [ Enigma Machine] ( https://github.com/TheAlgorithms/Python/blob/master/hashes/enigma_machine.py )
Original file line number Diff line number Diff line change 1- # Created by sarathkaul on 14/11/19
1+ """ Created by sarathkaul on 14/11/19 """
22
33
44def remove_duplicates (sentence : str ) -> str :
@@ -7,13 +7,7 @@ def remove_duplicates(sentence: str) -> str:
77 >>> remove_duplicates("Python is great and Java is also great")
88 'Java Python also and great is'
99 """
10- sen_list = sentence .split (" " )
11- check = set ()
12-
13- for a_word in sen_list :
14- check .add (a_word )
15-
16- return " " .join (sorted (check ))
10+ return " " .join (sorted (set (sentence .split (" " ))))
1711
1812
1913if __name__ == "__main__" :
You can’t perform that action at this time.
0 commit comments