Redeemable Promotion Offers
You are given promotion offer definitions and user redemption events. Each offer string has the format offerId,startDate,endDate,maxRedeemsPerUser. Each event string has the format userId,date,action,offerId, where action is either redeem or unredeem.
For every user that appears in the event log, determine which offers they can still redeem on cutoffDate. An offer is redeemable if the cutoff date is within the offer's date range and the user's net redeemed count for that offer is less than maxRedeemsPerUser. Return one line per user in ascending user id order as userId:offerA,offerB, with offer ids sorted ascending. If no user can redeem any offer, return ["None"].
1Example 1
User u1 has one remaining redemption for O1 but none for O2. User u2 can redeem both active offers.
2Example 2
The only offer has expired before the cutoff date.
Constraints
Limits and guarantees your solution can rely on.
Dates use ISO YYYY-MM-DD strings and can be compared lexicographically.