Top K Frequent IP Addresses
Asked at NewsBreak · Coding Questions · Difficulty: Medium
Given a string representing a multi-line log file where each line contains an IP address, write a function to find the top `k` frequent IP addresses. Assume `k` is a positive integer not greater than the number of unique IP addresses. The output should be a list of `k` tuples with the IP address and its frequency.
Loading the problem…
More NewsBreak interview questions
- Fit a 1D Two-Segment Piecewise-Constant Regression (Minimize MSE)
- Insert Node into Sorted Singly Linked List
- Two-Team Turn-Based Battle Simulator
- Toy Language Type System
- Grid Infection and Immunity Simulation
- Earliest Supporting Version with a Probe Budget