Atrium Performance Call Sheet
In Atrium Performance Call Sheet, you are given a list of time strings such as "14:10" or "23:59". Your job is to return true if the times are already in chronological order from left to right, and false if any later position moves backward in time.
The format matters here. The times use a fixed HH:MM layout with leading zeroes, which means values like "09:15" and "14:45" can be compared directly in order. You are not being asked to sort the list or build a new one. You only need to decide whether the given schedule is already ordered.
For example, times = ["14:10","14:45","15:00","15:00"] should return true because the times never go backward, and equal values are allowed. But times = ["09:30","09:15","09:45"] should return false because the second value is earlier than the first.
So the task is to walk through the list and check whether each time is greater than or equal to the one before it.
Example Input & Output
The schedule never moves backward, and repeated times are still allowed.
The second time is earlier than the first, so the order is broken.
Moving from 23:59 to 00:00 goes backward if the list is treated as one same-day schedule.
Algorithm Flow

Solution Approach
The cleanest solution is to scan the list once and compare each time string with the previous one. If the current time is ever smaller than the previous time, then the schedule is not in chronological order and you can return false immediately. If you finish the scan without finding any backward step, the answer is true.
The nice trick in this problem is that you usually do not need to parse hours and minutes into separate integers. Because every time is written in zero-padded HH:MM format, normal string comparison already matches chronological order. For example, "09:15" < "14:10" as strings, and that is also true as times. The same idea works for minutes because the colon is in the same position for every value.
That means the logic can stay simple:
This works because a sorted sequence only needs every neighboring pair to be in order. If times[i] is always at least as large as times[i - 1], then the full list is ordered. The first time a pair breaks that rule, the whole schedule fails.
Equal values should still pass. A list like ["15:00", "15:00"] is fine because it does not move backward. Empty input also returns true, since there is no pair that violates the ordering rule. A one-element list is trivially ordered for the same reason.
This one-pass approach is efficient. The time complexity is O(n) because you inspect each time once. The space complexity is O(1) because you only keep track of the current position and compare existing values. It is also better than sorting a copy and comparing results, because sorting would cost more work and is unnecessary when a simple scan can answer the question directly.
So the full strategy is: take advantage of the fixed HH:MM format, compare each time string with the previous one, and return false on the first backward step. If no backward step appears, return true.
Best Answers
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;
}
}Comments (0)
Join the Discussion
Share your thoughts, ask questions, or help others with this Challenge.
