BudiBadu Logo
00:00

Festival Cabins Sorted Flag

Sorting Algorithms Easy 0 views

During the lantern-lit festival, every lodging request is logged as the guests stroll past the registration pavilion. Coordinators list the cabin names exactly as they appear on the chalkboard placards—some in uppercase, some in lowercase, others with whimsical spacing—because the hosts love to celebrate personal flair. Before the evening rush begins, the logistics team needs a quick signal that the queue already flows alphabetically by cabin name so they can release the volunteer ushers without shuffling clipboards. Your task is to inspect the list and answer with a single true or false, leaving the original order untouched.

Comparisons should ignore casing while still respecting the written characters when reporting back, which means “Star Gazer” and “star gazer” should be considered equal neighbors. Extra spaces inside the names are intentional and should not be trimmed or altered. If the list is empty because no one has arrived yet, the function should return true, reaffirming that the hosts can relax. The routine only needs to confirm whether the names never descend when compared case-insensitively, providing a reliable flag that keeps the festival walkway clear of last-minute scrambles.

Example 1:

Input: cabins = ["Aurora Haven","Celestial Loft","glow deck"]
Output: true
Explanation: Each name follows the next alphabetically when casing is ignored.

Example 2:

Input: cabins = ["Harbor Light","Garden Nook","Harbor Loft"]
Output: false
Explanation: "Harbor Light" should appear after "Garden Nook" when compared alphabetically.

Example 3:

Input: cabins = []
Output: true
Explanation: An empty arrival log is already in order, so the ushers can stand down.

Related Problems

No related problems found

Comments (0)

Join the Discussion

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

BudiBadu Logo

Festival Cabins Sorted Flag

Sorting Algorithms Easy 0 views

During the lantern-lit festival, every lodging request is logged as the guests stroll past the registration pavilion. Coordinators list the cabin names exactly as they appear on the chalkboard placards—some in uppercase, some in lowercase, others with whimsical spacing—because the hosts love to celebrate personal flair. Before the evening rush begins, the logistics team needs a quick signal that the queue already flows alphabetically by cabin name so they can release the volunteer ushers without shuffling clipboards. Your task is to inspect the list and answer with a single true or false, leaving the original order untouched.

Comparisons should ignore casing while still respecting the written characters when reporting back, which means “Star Gazer” and “star gazer” should be considered equal neighbors. Extra spaces inside the names are intentional and should not be trimmed or altered. If the list is empty because no one has arrived yet, the function should return true, reaffirming that the hosts can relax. The routine only needs to confirm whether the names never descend when compared case-insensitively, providing a reliable flag that keeps the festival walkway clear of last-minute scrambles.

Example 1:

Input: cabins = ["Aurora Haven","Celestial Loft","glow deck"]
Output: true
Explanation: Each name follows the next alphabetically when casing is ignored.

Example 2:

Input: cabins = ["Harbor Light","Garden Nook","Harbor Loft"]
Output: false
Explanation: "Harbor Light" should appear after "Garden Nook" when compared alphabetically.

Example 3:

Input: cabins = []
Output: true
Explanation: An empty arrival log is already in order, so the ushers can stand down.

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.