What is the time complexity of the following Python code snippet? Python def…
PYQ Deloitte Hiring Assessment 2024
What is the time complexity of the following Python code snippet?
Python
def find_duplicates(arr):
duplicates = []
for i in range(len(arr)):
for j in range(i + 1, len(arr)):
if arr[i] == arr[j]:
duplicates.append(arr[i])
return duplicates
- A.
O(n)
- B.
O(log n)
- C.
O(n^2)
- D.
O(1)
Attempted by 220 students.
Sign up free to check your answer
Sign up freeLoading lesson…

