Find the Most Frequent Log Call
RobloxMachine Learning Engineer · Technical ScreenLast updated
This question evaluates a candidate's ability to perform frequency analysis on sequences, demonstrating competency with data structures for counting occurrences and with algorithmic time and space complexity considerations.
You are given a sequence of application log entries. Each entry contains the name of a function or API call made by the system. Write a function that returns the call that appears most frequently in the logs, along with its frequency.
Example:
- Input: ["login", "search", "login", "checkout", "search", "login"]
- Output: ("login", 3)
Follow-up discussion can include how to handle ties, how to return the top-k most frequent calls, and how to process logs in a streaming or large-scale setting.
Solution walkthrough is for members
Get the full walkthrough with reference code and complexity analysis, plus Kitty Coach at 300 messages a day. Hints, the code runner and community answers stay free.