Back to problems

Log Parser for Top N Items

Algorithm · NVIDIA · Easy

Given a log represented as a list of strings, write a program that counts how often each item occurs and returns the N most frequent items. Treat every line or list element as one item, and assume all items are strings. Implement parse_log_and_find_top_n_items(log: List[str], n: int) -> List[str]. Input: log contains the log records, with one string per element. n specifies how many of the most frequent items to return. Output: Return a list of strings containing the top N…

Checking your access…