BudiBadu Logo

Catalog Shelf Lineup

Graph Easy 1 views
Like5

In the studio catalog center, sample labels arrive in a jumble. Your task in Catalog Shelf Lineup is to take this arrival list and return a brand-new version where the numbers run from the smallest label to the largest. The original list must stay untouched for auditing, so your helper routine creates a separate, orderly layout that the styling team can use to plan their storyboard shoot.

The "secret sauce" here is Non-Destructive Sorting. Your shipment might include matching props (duplicate labels) or negative placeholders for items still in transit. Your routine must keep every single entry present, placing them into ascending order without compression or padding. This ensures the production lead can trust the final shot list, avoiding manual recounts that disrupt the entire photo set. It’s a fast, reliable, and professional way to keep the studio running with maximum efficiency!

If sorting is part of the strategy, do it intentionally as a preprocessing step to simplify downstream logic such as merging, ordering, or comparison. After sorting, keep output semantics precise: preserve expected structure, avoid dropping valid entries, and ensure tied cases still follow deterministic order rules.

Examples

Example 1
Input
nums = [6,-1,6,2]
Output
[-1,2,6,6]
Explanation

Negative placeholders and repeats remain visible in ascending order.

Example 2
Input
nums = [0]
Output
[0]
Explanation

A single sample remains unchanged because it is already in order.

Example 3
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.

Algorithm Flow

Recommendation Algorithm Flow for Catalog Shelf Lineup - Budibadu
Recommendation Algorithm Flow for Catalog Shelf Lineup - Budibadu

Best Answers

java
import java.util.*;

class Solution {
    public int[] catalog_shelf_lineup(int[] nums) {
        int[] result = nums.clone();
        Arrays.sort(result);
        return result;
    }
}