Your question is Top Error Codes from Logs. 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 an array of log lines logs, where each line is a string, write a function that extracts error codes and returns the 10 most frequent codes. An error code is any token that starts with ERROR_ and is followed by uppercase letters, digits, or underscores. Return a list of (code, count) pairs sorted by descending frequency, and break ties by lexicographically smaller code first.
ERROR_[A-Z0-9_]+def top_error_codes(logs):