FastPrepE-commerce Notification Router
Problems/E-commerce Notification Router

E-commerce Notification Router

Amazon logoAmazon● EasyFULLTIMEPHONE SCREEN
QuestionFunctionExamplesConstraints

Problem statement

Source note: The source specifies preferred-channel and urgent routing while excluding handler implementation, but it omits a batch interface and output order. The judged core task matches the visible source at about 96%.

Implement the routing decision for a batch of e-commerce notifications. For notification i, preferredChannels[i] is the user's preferred channel and priorities[i] is either NORMAL or URGENT.

  • A NORMAL notification routes only to the user's preferred channel.
  • An URGENT notification routes to all channels in the fixed order EMAIL, SMS, PUSH.

Return one channel array per notification. Implement only the routing decisions; delivery handlers and delivery success are outside this task.

Function

routeNotifications(preferredChannels: String[], priorities: String[]) → String[][]

Examples

Example 1

preferredChannels = ["EMAIL","SMS","PUSH"]priorities = ["NORMAL","URGENT","NORMAL"]return = [["EMAIL"],["EMAIL","SMS","PUSH"],["PUSH"]]

The normal notifications use their preferences, while the urgent notification is sent through all three routing channels.

Example 2

preferredChannels = ["PUSH"]priorities = ["URGENT"]return = [["EMAIL","SMS","PUSH"]]

Urgency overrides the preferred channel and selects every channel in canonical order.

Example 3

preferredChannels = ["SMS","EMAIL"]priorities = ["NORMAL","NORMAL"]return = [["SMS"],["EMAIL"]]

Each normal notification produces exactly one route.

Constraints

  • 1 <= preferredChannels.length == priorities.length <= 10^5.
  • Every preferred channel is EMAIL, SMS, or PUSH.
  • Every priority is NORMAL or URGENT.

More Amazon problems

  • Count Adjacent Symbol Pairs for BPEONSITE INTERVIEW · Seen Nov 2026
  • First Non-Repeating CharacterOA · ONSITE INTERVIEW · Seen Nov 2026
  • Lowest Common Ancestor in an N-ary TreePHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
See Amazon hiring insights
Saved
class Solution {
    public String[][] routeNotifications(String[] preferredChannels, String[] priorities) {
      // write your code here
    }
}
Checking account…