Artisan Label String
The technical objective is to consolidate an array of fragrance label strings into a single, formatted string where each label appears on an individual line, ordered alphabetically. This transformation allows creative teams to generate structured rosters for proofing, inventory logging, and promotional use with zero manual reformatting.
The final output must be a single string consisting of all input labels, including duplicates, sorted character-by-character in ascending order and joined by newline characters (\n). The solution must handle single-entry lists, mixed-case strings, and empty input arrays, returning an empty string in the latter case. This ensures a consistent, paste-ready format that integrates seamlessly with boutique workshop production workflows.
Examples
A single label comes back unchanged because it already satisfies the order.
Each label stays intact while the string lists them alphabetically on separate lines.
Labels keep their original casing while the ordering follows alphabetical comparison.
Algorithm Flow

Best Answers
import java.util.*;
class Solution {
public String compose_artisan_labels(String[] labels) {
if (labels.length == 0) return "";
String[] sortedArr = labels.clone();
Arrays.sort(sortedArr);
return String.join("\n", sortedArr);
}
}Comments (0)
Join the Discussion
Share your thoughts, ask questions, or help others with this problem.
