A climbing gym logs every badge scan at the door. days is a list with one entry per opening day, and each entry is the list of names scanned that day, in the order they arrived. A member who pops out for lunch is scanned twice, so a name can appear more than once in a day.
Write visitor_report(days) that returns a tuple (regulars, newcomers):
regularsis the alphabetically sorted list of the names that were scanned on every day;newcomersis a list with one number per day: how many different names were scanned that day that had never been scanned on an earlier day.
If days is empty, return ([], []).
The helper scan_log(days, people, seed) returns a random log with that many days and members.
Examples
Input: days = [["ana", "ben", "ana"], ["ben", "cy"], ["cy", "ben", "dee"]]
Output: (["ben"], [2, 1, 1])
Explanation: only ben came every day. Day 1 brings ana and ben (ana's second scan
does not count again), day 2 brings cy, day 3 brings dee.
Input: days = [["ana"], [], ["ana"]]
Output: ([], [1, 0, 0])
Constraints
0 <= len(days) <= 300- at most
2 * 10**5scans in total
Goals
- Keep a running intersection and a running union of sets
- Use set difference to find what is new