As reported: Autodesk Principal Engineer (Staff backend, Java) loop (2026), round 2 (90 minutes): low-level design of a Notification Service supporting Email, SMS and Push — classes and interfaces, extensibility, channel abstraction and trade-offs.
Design a notification service. Users register their contact details (an email address, a phone number, a device token for push — any of them may be missing) and can turn individual channels off. When the service is asked to notify a user, it delivers the message on every channel the user can be reached on and has not disabled. Adding a new channel (e.g. Slack or WhatsApp) must not require changing the code that sends notifications.
Implement NotificationService:
registerUser(userId, email, phone, deviceToken)— create or replace a user; an empty string means that contact detail is missing. All channels start enabled.setChannelEnabled(userId, channel, enabled)—channelis"EMAIL","SMS"or"PUSH". Returnfalseif the user or the channel is unknown, elsetrue.send(userId, message)— delivermessageand return one entry"<CHANNEL>:<address>"per delivery, in the orderEMAIL,SMS,PUSH. Unknown user → empty list. An emptymessageis not sent (empty list).deliveredCount(channel)— how many deliveries that channel has made so far (0for an unknown channel).
Example
["NotificationService","registerUser","send","setChannelEnabled","send","deliveredCount"]
[[],["u1","[email protected]","+15550100",""],["u1","Build passed"],["u1","SMS",false],["u1","Deploy done"],["EMAIL"]]
-> [null,null,["EMAIL:[email protected]","SMS:+15550100"],true,["EMAIL:[email protected]"],2]
u1 has no device token, so push is skipped; after SMS is disabled only email is used.
Constraints: at most 10^4 calls; ids, addresses and messages are non-empty printable strings of at most 50 characters (except the empty strings described above).
Code runner format: LeetCode's design format — line 1 the method names, line 2 their arguments. The harness prints the list of results (null for the constructor and registerUser).
Discuss the class design, how a new channel is added, and the trade-offs (synchronous vs queued delivery, retries, rate limits) as you would in the round.