You’re building a compliance check for a fintech payout system processing tens of millions of transfers per day. Regulators require that payouts to blocked merchant IDs be detected quickly and deterministically. Your service receives (1) a list of blocked merchant IDs updated hourly and (2) a batch of payout merchant IDs for the last minute. You must report which blocked IDs appear in the payout batch, including how many times each appears.
Implement a function:
blocked: list[int] — merchant IDs that must not receive payoutspayouts: list[int] — merchant IDs present in a payout batch (may contain duplicates)[(merchant_id, count), ...] for every merchant_id in blocked that appears in payouts, where count is the number of occurrences in payouts.merchant_id ascending.payouts, it must not be included.blocked should be treated as a single ID (i.e., output each ID at most once).Input:
blocked = [42, 7, 7, 100]payouts = [5, 7, 7, 7, 9, 42]Output:
[(7, 3), (42, 1)]Explanation:
Merchant 7 appears three times in the payout batch and is blocked. Merchant 42 appears once and is blocked. Merchant 100 is blocked but does not appear.
Input:
blocked = [3, 1, 2]payouts = [2, 2, 2, 4]Output:
[(2, 3)]Explanation:
Only merchant 2 is both blocked and present, and it appears three times.
0 <= blocked.length, payouts.length <= 2 * 10^5-10^9 <= merchant_id <= 10^9O(len(blocked) * len(payouts)).