We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent f396f7a commit 12f0beeCopy full SHA for 12f0bee
Sprint-1/Python/find_common_items/find_common_items.py
@@ -14,8 +14,10 @@ def find_common_items(
14
Optimal time complexity:
15
"""
16
common_items: List[ItemType] = []
17
+ second_sequence_set = set(second_sequence)
18
+
19
for i in first_sequence:
- for j in second_sequence:
- if i == j and i not in common_items:
20
- common_items.append(i)
21
- return common_items
+ if i in second_sequence_set and i not in common_items:
+ common_items.append(i)
22
23
+ return common_items
0 commit comments