Amazon Phone Screen
Anonymous User
952
May 02, 2022

forecast = [
{
"warehouse_id": "JAC",
"date_time": 6,
"forecasted_order_volume": 30
},
{
"warehouse_id": "JAC",
"date_time": 7,
"forecasted_order_volume": 45
},
{
"warehouse_id": "JAC",
"date_time": 8,
"forecasted_order_volume": 60
},

{
"warehouse_id": "BZN",
"date_time": 6,
"forecasted_order_volume": 60
}
]

delivery_windows = [
{
"warehouse_id": "JAC",
"start_time": 4,
"end_time": 8
},
{
"warehouse_id": "JAC",
"start_time":8,
"end_time": 12
},
{
"warehouse_id": "JAC",
"start_time": 12,
"end_time": 16
},
{
"warehouse_id": "BZN",
"start_time": 6,
"end_time": 20
}
]

Using the above data sources

  1. Output the total forecasted order volume at the "JAC" warehouse, for date 2021-02-02, aggregated by each delivery window

Example Output

expected = [
{
"warehouse": "JAC",
"start_time": "04:00:00",
"end_time": "08:00:00",
"date": "2021-02-02",
"forecasted_volume": 75
},

{
"warehouse": "JAC",
"start_time": '08:00:00',
"end_time": '12:00:00',
"date": "2021-02-02",
"forecasted_volume": 60
}
]

Comments (1)