BudiBadu Logo
00:00

Warehouse Palette Order

Sorting Algorithms Easy 0 views

In the museum ticket office, digital reservations arrive as seat numbers but rarely in the order guests will be greeted. The floor coordinator needs a helper routine that reads the incoming ledger and returns a brand-new list where the seat numbers rise from the lowest to highest value. The original ledger stays untouched for auditing, so the routine must create a separate tidy sequence that staff can hand to ushers who arrange the crowd control ropes.

Some nights bring group bookings that repeat the same seat number, while special events add negative placeholders for blocked-off rows. The routine must keep every entry, whether duplicated or unconventional, placing them in the correct rising order without introducing gaps. When the reservations already happen to be in sequence, the helper should simply echo the input, assuring the coordinator that nothing needs attention before the ushers open the doors.

Before final signage prints, the lead supervisor runs a comparison between the helper's output and a trusted reference schedule. A single mismatch - missing seat, wrong position, or extra padding - forces a manual recount that slows the entire check-in process. Return an ordered list the supervisor can trust, including the quiet case where no reservations exist and an empty list must be returned, so the welcome team can focus on greeting guests instead of re-sorting paperwork.

Example 1:

Input: nums = [5,1,5,3]
Output: [1,3,5,5]
Explanation: The usher list shows the seat numbers in ascending order while preserving both copies of 5.

Example 2:

Input: nums = [8]
Output: [8]
Explanation: A single reservation remains unchanged because it already satisfies the order.

Example 3:

Input: nums = [2,-3,2,0]
Output: [-3,0,2,2]
Explanation: Negative and zero values appear alongside repeats in the correct rising order.

Related Problems

No related problems found

Comments (0)

Join the Discussion

Share your thoughts, ask questions, or help others with this problem.

BudiBadu Logo

Warehouse Palette Order

Sorting Algorithms Easy 0 views

In the museum ticket office, digital reservations arrive as seat numbers but rarely in the order guests will be greeted. The floor coordinator needs a helper routine that reads the incoming ledger and returns a brand-new list where the seat numbers rise from the lowest to highest value. The original ledger stays untouched for auditing, so the routine must create a separate tidy sequence that staff can hand to ushers who arrange the crowd control ropes.

Some nights bring group bookings that repeat the same seat number, while special events add negative placeholders for blocked-off rows. The routine must keep every entry, whether duplicated or unconventional, placing them in the correct rising order without introducing gaps. When the reservations already happen to be in sequence, the helper should simply echo the input, assuring the coordinator that nothing needs attention before the ushers open the doors.

Before final signage prints, the lead supervisor runs a comparison between the helper's output and a trusted reference schedule. A single mismatch - missing seat, wrong position, or extra padding - forces a manual recount that slows the entire check-in process. Return an ordered list the supervisor can trust, including the quiet case where no reservations exist and an empty list must be returned, so the welcome team can focus on greeting guests instead of re-sorting paperwork.

Example 1:

Input: nums = [5,1,5,3]
Output: [1,3,5,5]
Explanation: The usher list shows the seat numbers in ascending order while preserving both copies of 5.

Example 2:

Input: nums = [8]
Output: [8]
Explanation: A single reservation remains unchanged because it already satisfies the order.

Example 3:

Input: nums = [2,-3,2,0]
Output: [-3,0,2,2]
Explanation: Negative and zero values appear alongside repeats in the correct rising order.

00:00
Loading editor...
Test Results

Run your code to see test results

Click the Submit button to execute your solution

Related Problems

No related problems found

Comments (0)

Join the Discussion

Share your thoughts, ask questions, or help others with this problem.