Amazon delivery trucks 🚚

Scenario

Amazon Prime Now has 17-hour long days during which it deploys its fleet of trucks. The Order Forecaster for a region is really good at what they do and can give the exact number of trucks needed during each hour block for the coming day. The forecast schedule is in the form of a 17 element array. We can only deploy (add) trucks at the very beginning of the day, and any leftover trucks at the end of the day are automatically sent to maintenance. How would we algorithmically maintain a minimal service fleet? For example if the required number of trucks is forecasted as:

hour 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
#trucks 5 5 5 5 5 5 5 3 4 4 3 1 0 0 0 0 1

The optimal decommissioning schedule is:

hour 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
+/-trucks 5 0 0 0 0 0 0 -1 0 0 -1 -2 0 0 0 0 0

Read More

Quest of The Delta Knights ⚔

Lord Vultare has stolen Archimedes’s heat ray 🔥🔥

… and it’s up to Leonardo to take back the weapon before Lord Vultare uses it to seige the kingdom 🏟. Both Lord Vultare and Leonardo are still in the Phantom Zone, but Lord Vultare has already started making his way back to our world! The Phantom Zone has many intersecting dimensions and time streams, so Leonardo can’t just run up to Lord Vultare because they are seperated by time and space. Luckily, Leonardo has the Antikythera that allows him to instantaneously travel through time 🕰 and space 🌌. He can catch up to Lord Vultare near-instantly, but he can only travel in a specific combination of dimensions and time moments relative to his current dimension and time. These moves are summarized as moving +/-3 dimensions and +/-1 moments, or, +/-1 dimensions and +/-3 moments.

The Phantom Zone has a finite number of dimensions and time frames though, given as DIMENSIONS dimensions and MOMENTS moments, and nobody can exist beyond those bounds. Given that Leonardo starts in the d dimension and m moment, and Lord Vultare is in x dimension and y moment, what is the minimum sequence of moves does he have to take to catch Lord Vultare?

Read More