Your question is Top K Frequent Security Events. 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.
Given a list of log lines logs, where each line is a string in the format "timestamp source severity event_id message", and an integer k, return the k most frequent event_id values among lines whose severity is at least min_severity. Severity order is DEBUG < INFO < WARN < ERROR < CRITICAL. If two event IDs have the same frequency, return the lexicographically smaller one first. Ignore malformed lines.
def top_k_security_events(logs, k, min_severity):