BackmediumQueue Atlassian

Sequential Brewing Schedule Solution

Problem Statement

Given a list of potion brewing tasks, each with a brewing time and a sequence of ingredient addition times, implement a queue to manage the brewing process and determine the order in which the potions should be brewed.

Example 1
Input
[{ 'brewing_time': 10, 'ingredients': [2, 5, 8] }, { 'brewing_time': 8, 'ingredients': [1, 4, 7] }]
Output
["[{","'brewing_time':","10,","'ingredients':","[2,","5,","8]","},","{","'brewing_time':","8,","'ingredients':","[1,","4,","7]","}]"]

Explanation: The brewing tasks are ordered based on their brewing times and ingredient addition times.

Example 2
Input
[{ 'brewing_time': 5, 'ingredients': [1] }, { 'brewing_time': 5, 'ingredients': [2] }]
Output
["[{","'brewing_time':","5,","'ingredients':","[1]","},","{","'brewing_time':","5,","'ingredients':","[2]","}]"]

Explanation: When multiple brewing tasks have the same brewing time, their order is determined by the order of their ingredient addition times.

Example 3
Input
[{ 'brewing_time': 15, 'ingredients': [3, 6, 9, 12] }]
Output
["[{","'brewing_time':","15,","'ingredients':","[3,","12]","6,","9,","}]"]

Explanation: A single brewing task is ordered based on its brewing time and ingredient addition times.

Constraints

  • 1 <= number of brewing tasks <= 1000
  • 1 <= brewing time <= 1000
  • 1 <= number of ingredients <= 10
  • 1 <= ingredient addition time <= brewing time
Live Compiler
Loading...
Test Cases & Output
🔒 Sign up to run your code

🚀 Practice this problem

Run code, get AI hints & track streak

Sign Up Free