Given a log file with columns timestamp and latency (unsorted, repeated timestamps), print for each timestamp the maximum latency, sorted by timestamp.
Asked in the onsite stage. Practical SRE-style log parsing task.
Implement max_latency_by_timestamp(records), where records is a list of [timestamp, latency] pairs. Return a list of [timestamp, maximum_latency] pairs ordered by ascending timestamp. Return an empty list when the log has no records.
def max_latency_by_timestamp(records):