Your question is Find Frequent Error Sequences. Start with the requirements on the right.
Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.
Astra logs contain timestamped error codes generated by platform components. Given a list of log events and a sequence length k, return the most frequent contiguous sequence of k error codes after ordering events chronologically.
Each event is represented as [timestamp, error_code], where timestamp is a unique integer and error_code is a string. Count overlapping sequences. If multiple sequences have the same highest frequency, return the lexicographically smallest sequence. Return an empty list when fewer than k events are provided.
Implement most_frequent_error_sequence(logs, k).
logs, a list of [int, str] pairs, and positive integer kk error-code strings representing the selected sequencedef most_frequent_error_sequence(logs, k):