We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
birdsid_count = {}
for i in arr:
if i in birdsid_count:
birdsid_count[i] += 1
else:
birdsid_count[i] = 1
max_ids = max(birdsid_count.values())
max_items = [key for key, value in birdsid_count.items() if value == max_ids]
results = min(max_items)
return results
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Migratory Birds
You are viewing a single comment's thread. Return to all comments →
python3
birdsid_count = {} for i in arr: if i in birdsid_count: birdsid_count[i] += 1 else: birdsid_count[i] = 1 max_ids = max(birdsid_count.values()) max_items = [key for key, value in birdsid_count.items() if value == max_ids] results = min(max_items) return results