Objects Shared by Two Logs
Asked at Google
Reported by the problem's creator, not verified
Each log is a list of entries [timestamp, obj_id, client_id]: at time timestamp, client client_id used object obj_id. Both ids are strings, and the logs are not sorted.
Examples
Example 1
Input: log_a =
[[1,"X","c1"],[2,"X","c2"],[3,"Y","c1"]], log_b =[[4,"X","c1"],[5,"Z","c2"]]Output:
["X"]Explanation:
Xappears in both logs and its clients across the two logs arec1andc2, so it qualifies.Yappears only inlog_aandZonly inlog_b, so neither qualifies.Example 2
Input: log_a =
[[1,"p","c1"],[2,"q","c1"],[3,"r","c2"],[4,"r","c2"]], log_b =[[1,"p","c1"],[2,"q","c2"],[3,"r","c2"],[4,"s","c9"]]Output:
["q"]Explanation:
pis used only byc1andronly byc2, so each has a single client and neither counts.qis used byc1inlog_aand byc2inlog_b, giving it two clients, so it counts.