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 c5a314e commit 593e448Copy full SHA for 593e448
Sprint-1/Python/find_common_items/find_common_items.py
@@ -9,13 +9,8 @@ def find_common_items(
9
"""
10
Find common items between two arrays.
11
12
- Time Complexity:
13
- Space Complexity:
14
- Optimal time complexity:
+ Time Complexity: O(n) - nested loop
+ Space Complexity: O(n)
+ Optimal time complexity: O(n)
15
16
- common_items: List[ItemType] = []
17
- for i in first_sequence:
18
- for j in second_sequence:
19
- if i == j and i not in common_items:
20
- common_items.append(i)
21
- return common_items
+ return list(set(first_sequence) & set(second_sequence))
0 commit comments