Your question is Top Error Message in Last Hour. 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.
Salesforce Event Monitoring produces a time-ordered stream of error logs. Given the logs received up to a specified time, return the most frequent error message from the inclusive one-hour window ending at that time.
Messages are compared exactly, including capitalization and whitespace. If multiple messages have the same highest frequency, return the lexicographically smallest message. Return an empty string when the window contains no logs.
Implement most_frequent_error(logs, current_time).
logs is a list of two-element lists, where each entry is [timestamp, message].timestamp is an integer number of seconds, and message is a string.current_time.[current_time - 3600, current_time]."" if no log is in the window.def most_frequent_error(logs, current_time):