Artisan Display Sort
During the artisan market's morning rush, booth numbers are logged in the order vendors wheel their carts inside, so the coordinator's ledger looks like a patchwork rather than the calm sequence shoppers follow. The floor manager has asked for a helper routine that reads the raw booth list and returns a fresh copy where the numbers climb from the smallest booth to the largest. The original ledger stays archived for insurance checks, meaning the routine must build a separate, polished list that captures every booth exactly as it appeared while presenting it in the reassuring order the hosts need for signage, crowd flow, and quick headcounts.
Weekend festivals introduce matching booth numbers for shared collectives, and facility maintenance annotates blocked aisles with negative placeholders, so the returned list has to keep every entry without bundling or skipping anything—simply slide each number into its proper ascending place. When the ledger already happens to be orderly, the helper should echo back the same sequence, signaling that no extra staging is required. Before doors open, operations compares the helper's output with a trusted floor plan and pauses the launch if any number is missing or out of place. Provide a response that matches the reference exactly, including the quiet case where no booths are scheduled and an empty list confirms setup is finished.
Example 1:
Input: nums = [14,5,12,5]
Output: [5,5,12,14]
Explanation: Shared booths keep both entries while the list rises from smallest to largest.
Example 2:
Input: nums = [3]
Output: [3]
Explanation: A single booth remains unchanged because the ledger was already in order.
Example 3:
Input: nums = [9,-2,4,9]
Output: [-2,4,9,9]
Explanation: Negative placeholders and repeats stay visible in ascending order.
Related Problems
No related problems found
Comments (0)
Join the Discussion
Share your thoughts, ask questions, or help others with this problem.
