BudiBadu Logo
00:00

Market Slate Phrase

Sorting Algorithms Easy 0 views

The night market's storytelling corner prints placards for every featured narrator, and the coordinator logs each card title in the whirlwind order performers hand them over. The running list is faithful to spelling and punctuation, yet impossible to read at a glance. The coordinator asked for a helper routine that reads these raw titles and returns one polished string where the entries appear alphabetically and are separated by " | " so the signage crew can paste them straight into their lightbox display. The original list remains frozen for archival paperwork, making it essential that the function leave the source untouched while presenting a calm, ready-to-print summary.

Collaborations occasionally repeat the same headline, and themed evenings invite playful lowercasing or emoji sprinkled into the text. The helper must therefore keep every card title exactly as written, merely sorting them from A to Z before joining them with the requested separator. When the cards already arrive alphabetically, the resulting string should mirror the original order without change. If the storytellers have not submitted any titles yet, the function should return an empty string so the signage crew immediately knows the slate is blank. This refined phrase saves late-night edits and keeps the corner's illuminated board perfectly in sync with the performers.

Example 1:

Input: titles = ["Moonlit Trail","Amber Echo","Amber Echo","Garden Lanterns"]
Output: "Amber Echo | Amber Echo | Garden Lanterns | Moonlit Trail"
Explanation: Each card title remains intact while the phrase alphabetizes the lineup with bar separators.

Example 2:

Input: titles = ["Solace"]
Output: "Solace"
Explanation: A single card returns exactly as received because it already meets the ordering rule.

Example 3:

Input: titles = ["ember","Aurora Pulse","Beacon"]
Output: "Aurora Pulse | Beacon | ember"
Explanation: Titles keep their original casing while the phrase follows alphabetical comparison.

Related Problems

No related problems found

Comments (0)

Join the Discussion

Share your thoughts, ask questions, or help others with this problem.

BudiBadu Logo

Market Slate Phrase

Sorting Algorithms Easy 0 views

The night market's storytelling corner prints placards for every featured narrator, and the coordinator logs each card title in the whirlwind order performers hand them over. The running list is faithful to spelling and punctuation, yet impossible to read at a glance. The coordinator asked for a helper routine that reads these raw titles and returns one polished string where the entries appear alphabetically and are separated by " | " so the signage crew can paste them straight into their lightbox display. The original list remains frozen for archival paperwork, making it essential that the function leave the source untouched while presenting a calm, ready-to-print summary.

Collaborations occasionally repeat the same headline, and themed evenings invite playful lowercasing or emoji sprinkled into the text. The helper must therefore keep every card title exactly as written, merely sorting them from A to Z before joining them with the requested separator. When the cards already arrive alphabetically, the resulting string should mirror the original order without change. If the storytellers have not submitted any titles yet, the function should return an empty string so the signage crew immediately knows the slate is blank. This refined phrase saves late-night edits and keeps the corner's illuminated board perfectly in sync with the performers.

Example 1:

Input: titles = ["Moonlit Trail","Amber Echo","Amber Echo","Garden Lanterns"]
Output: "Amber Echo | Amber Echo | Garden Lanterns | Moonlit Trail"
Explanation: Each card title remains intact while the phrase alphabetizes the lineup with bar separators.

Example 2:

Input: titles = ["Solace"]
Output: "Solace"
Explanation: A single card returns exactly as received because it already meets the ordering rule.

Example 3:

Input: titles = ["ember","Aurora Pulse","Beacon"]
Output: "Aurora Pulse | Beacon | ember"
Explanation: Titles keep their original casing while the phrase follows alphabetical comparison.

00:00
Loading editor...
Test Results

Run your code to see test results

Click the Submit button to execute your solution

Related Problems

No related problems found

Comments (0)

Join the Discussion

Share your thoughts, ask questions, or help others with this problem.