Please read the instructions carefully before starting the exam.
Once you start the exam, the timer will begin, and you cannot pause it.
Ensure that you complete and submit your code within the given time if the timer is enabled.
You're building a support ticket system for a busy customer service platform. Every time a customer submits a ticket, they are assigned a priority number (the lower the number, the higher the priority).
Your task is to implement a function that, given a list of incoming ticket priorities, returns the order in which tickets should be handled using a Min-Heap — always resolving the most urgent ticket first.
You must return the ordered list of ticket priorities as they are handled.
tickets
: A list of integers (1 ≤ priority ≤ 1000) representing ticket priority values.Return a list of integers representing the ticket priorities in the order they should be resolved (from lowest number to highest).
1 ≤ tickets.length ≤ 10⁴
input: [4, 2, 5, 1, 3] output: [1, 2, 3, 4, 5] Explanation: Min-Heap resolves the lowest priority first, so tickets are handled in increasing order.
input: [10, 9, 8, 7] output: [7, 8, 9, 10] Explanation: Even if submitted in reverse, Min-Heap ensures proper priority resolution.
input: [5] output: [5] Explanation: Only one ticket to handle.
input: [12, 3, 17, 1, 8, 6] output: [1, 3, 6, 8, 12, 17] Explanation: Tickets are extracted from the Min-Heap in ascending order of urgency.