BudiBadu Logo

Atrium Performance Call Sheet

Sorting Easy 5 views
Like30

The atrium’s director manages a call sheet where ensembles sign in as stage@act@priority. By sound check, the list is a scramble. Your mission in Atrium Performance Call Sheet is to transform these raw entries into a neatly formatted and ordered list ready for the crew radios.

The "secret sauce" is Custom Reformatting and Sorting. Each returned string must read "priority - stage: act". You must sort the list by integer priority, then by stage name alphabetically, and finally by the act title (case-insensitive). The function must be non-destructive, building a fresh sequence while leaving characters in the original strings untouched. Anything out of position could delay rehearsals and confuse the lighting team! This challenge turns a messy log into a professional-grade call sheet that keeps the entire atrium running smoothly throughout the festive evening!

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
entries = ["Balcony@Solo Light@6"]
Output
["6 - Balcony: Solo Light"]
Explanation

A single entry is reformatted without reordering.

Example 2
Input
entries = ["NorthWing@Aurora Bloom@4","Center@ember chorus@4","Center@Ember Chorus@4"]
Output
["4 - Center: Ember Chorus","4 - Center: ember chorus","4 - NorthWing: Aurora Bloom"]
Explanation

Priorities match, so stages sort alphabetically, and the act titles compare case-insensitively while preserving text.

Example 3
Input
entries = ["StageA@Lantern Waltz@2","StageB@Harbor Hymn@1","StageA@Lantern Waltz@1","StageC@Echo Lines@3"]
Output
["1 - StageA: Lantern Waltz","1 - StageB: Harbor Hymn","2 - StageA: Lantern Waltz","3 - StageC: Echo Lines"]
Explanation

Priority controls first, with ties broken by stage and then act name.

Algorithm Flow

Recommendation Algorithm Flow for Atrium Performance Call Sheet - Budibadu
Recommendation Algorithm Flow for Atrium Performance Call Sheet - Budibadu

Best Answers

java
import java.util.*;

class Solution {
    public String[] atrium_performance_call_sheet(String[] entries) {
        List<String[]> parsed = new ArrayList<>();
        for (String entry : entries) {
            String[] parts = entry.split("@");
            parsed.add(new String[]{parts[2], parts[0], parts[1], parts[1].toLowerCase()});
        }
        parsed.sort((a, b) -> {
            int p = Integer.compare(Integer.parseInt(a[0]), Integer.parseInt(b[0]));
            if (p != 0) return p;
            int s = a[1].compareTo(b[1]);
            if (s != 0) return s;
            return a[3].compareTo(b[3]);
        });
        String[] result = new String[parsed.size()];
        for (int i = 0; i < parsed.size(); i++) {
            String[] p = parsed.get(i);
            result[i] = p[0] + " - " + p[1] + ": " + p[2];
        }
        return result;
    }
}