Harbor Manifest Planner Log
The harbor logistics crew records incoming containers as strings in the format berth#cargo#sequence. While this works for the crane operators, the planners need an organized Harbor Manifest Planner Log to stage their forklifts correctly. Your mission is to take these raw entries and return a freshly sorted list based on a specific set of priority rules.
The "secret sauce" here is Custom Multi-Level Sorting. You must sort the manifest primarily by the cargo tag alphabetically (ignoring case), then by the numeric value of the sequence segment, and finally by the berth name to break any ties. Every character must survive exactly as recorded—no trimming or rewriting! Your routine should be non-destructive, always returning a brand-new list so supervisors can plan without any confusion.
This challenge is a fantastic way to master complex sorting logic and string parsing. It’s a professional-grade task where clear ordering rules are the key to keeping the harbor running smoothly!
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
Linen sorts ahead of tea, while tea entries remain in ascending sequence.
Cargo tag "algae" precedes "cocoa", and the algae crates follow sequence order before berth names are considered.
Cargo comparison ignores case, so both amber crates align before Quartz, and berth names settle the final ordering.
Algorithm Flow

Best Answers
import java.util.*;
class Solution {
public Object organize_manifest(Object input) {
String[] items;
if (input instanceof String[]) {
items = (String[]) input;
} else {
return "";
}
if (items.length == 0) return "";
String[] sorted = items.clone();
Arrays.sort(sorted);
StringBuilder sb = new StringBuilder();
for (int i = 0; i < sorted.length; i++) {
sb.append(sorted[i]);
if (i < sorted.length - 1) sb.append(" | ");
}
return sb.toString();
}
}Comments (0)
Join the Discussion
Share your thoughts, ask questions, or help others with this problem.
