Your question is Unread Notification Badge Counter. Start with the requirements on the right.
Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.
Given a list of notification events for a mobile app, return the unread badge count after processing all events. Each event is a list where the first value is the event type: "receive", "read", or "clear". A receive event adds a notification with a unique integer id, a read event marks that id as read if it exists and is unread, and a clear event removes all unread notifications. Return the final unread count as an integer.
receive and read, event format is [type, id] where 0 <= id <= 10^9clear, event format is ["clear"]receive eventsdef unread_badge_count(events):