Okta Interview Question

print duplicates in array with optimal solution