Catalog Shelf Lineup
In the company catalog studio, product samples arrive labeled with sequence numbers that correspond to shelf positions, yet the shipments are rarely arranged for the photographer's storyboard. The coordinator needs a helper routine that accepts the arrival list and returns a new list with numbers running from the smallest label to the largest. The received list must stay untouched for later auditing, so the helper creates a separate, orderly layout that stylist teams can pin onto their boards.
Limited editions can share the same label when identical props are required, and seasonal gaps introduce negative placeholders marking items still in transit. The helper must keep every entry present, placing them into ascending order without compressing duplicates or adding filler values. If the shipment is already aligned, the helper should simply return the same list so the coordinator knows no further staging is necessary before the photo set opens.
Before printing the daily shot list, the production lead cross-checks the helper's output against a validated plan. A single mismatch - missing sample, swapped position, or unintended padding - forces a manual recount that disrupts the shoot. Provide an ordered list the lead can trust, including the straightforward case where no samples arrive and the response must be empty, so the team can concentrate on lighting, styling, and scheduling instead of fixing paperwork.
Example 1:
Input: nums = [3,1,4,1]
Output: [1,1,3,4]
Explanation: Matching labels appear together after sorting while the smallest value leads the list.
Example 2:
Input: nums = [0]
Output: [0]
Explanation: A single sample remains unchanged because it is already in order.
Example 3:
Input: nums = [6,-1,6,2]
Output: [-1,2,6,6]
Explanation: Negative placeholders and repeats remain 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.
