BudiBadu Logo
00:00

Harbor Cargo Lineup

Sorting Algorithms Easy 0 views

At the harbor logistics yard, the scheduling console logs each container's tag number exactly as cranes set it down, leaving the entry list in a jumble that reflects the push and pull of the tide. Dock supervisors need a helper routine that reads the raw tags and produces a fresh list where the numbers climb from the smallest tag to the largest. The untouched console feed stays archived for customs, so the routine must hand back a separate, calmly ordered lineup that crews can radio to the stack managers before the next barge starts unloading.

Overflow days often deliver paired containers with matching tags, and inspection drills insert negative placeholders to reserve aisles, so the returned lineup has to keep every tag present while only adjusting their positions into ascending order. When a shift already arrives in order, supervisors expect the helper to echo the same sequence and confirm that nothing was disturbed. Before cranes lift the final tier, operations compares the helper's output with a trusted reference sheet and freezes the yard if any tag is missing or misplaced. Provide a response that matches the reference exactly, including the quiet case where no containers arrive and an empty list must be returned.

Example 1:

Input: nums = [42,17,17,5]
Output: [5,17,17,42]
Explanation: Duplicate container tags remain while the list rises from smallest to largest.

Example 2:

Input: nums = [12,-4,7,0]
Output: [-4,0,7,12]
Explanation: Negative placeholders and standard tags appear together in ascending order.

Example 3:

Input: nums = []
Output: []
Explanation: An empty shift returns an empty lineup for the crew.

Related Problems

No related problems found

Comments (0)

Join the Discussion

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

BudiBadu Logo

Harbor Cargo Lineup

Sorting Algorithms Easy 0 views

At the harbor logistics yard, the scheduling console logs each container's tag number exactly as cranes set it down, leaving the entry list in a jumble that reflects the push and pull of the tide. Dock supervisors need a helper routine that reads the raw tags and produces a fresh list where the numbers climb from the smallest tag to the largest. The untouched console feed stays archived for customs, so the routine must hand back a separate, calmly ordered lineup that crews can radio to the stack managers before the next barge starts unloading.

Overflow days often deliver paired containers with matching tags, and inspection drills insert negative placeholders to reserve aisles, so the returned lineup has to keep every tag present while only adjusting their positions into ascending order. When a shift already arrives in order, supervisors expect the helper to echo the same sequence and confirm that nothing was disturbed. Before cranes lift the final tier, operations compares the helper's output with a trusted reference sheet and freezes the yard if any tag is missing or misplaced. Provide a response that matches the reference exactly, including the quiet case where no containers arrive and an empty list must be returned.

Example 1:

Input: nums = [42,17,17,5]
Output: [5,17,17,42]
Explanation: Duplicate container tags remain while the list rises from smallest to largest.

Example 2:

Input: nums = [12,-4,7,0]
Output: [-4,0,7,12]
Explanation: Negative placeholders and standard tags appear together in ascending order.

Example 3:

Input: nums = []
Output: []
Explanation: An empty shift returns an empty lineup for the crew.

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.