Back to problems

Aggregate video time and unique pins in Python

Algorithm · Pinterest · Medium

The following tasks ask you to aggregate engagement records, remove duplicates, and select an optimum with tie-breaking. Each Python part should use a linear-time pass, and each SQL part requires a single query. Part A: Best Video Category (Python) You are given a list pins of engagement records and a dictionary category_map that maps each category ID to its display name. Each record in pins is a dictionary with the keys pin_id, category_id, time_spent, and pin_format. Only…

Checking your access…