Find frequent IPs from a huge file

Quick Overview

This question evaluates a candidate's competency in large-scale data processing and algorithm design, focusing on memory- and disk-constrained frequency estimation, streaming and approximation concepts.

Find frequent IPs from a huge file

Company: Asana

Role: Software Engineer

Category: Software Engineering Fundamentals

Difficulty: medium

Interview Round: Onsite

You are given a very large log file (too large to fit in memory). Each line contains an IPv4 address (e.g., `203.0.113.7`). Design an approach to answer one of these variants under memory constraints: - **Variant A:** Find the single most frequent IP. - **Variant B:** Find the top `K` most frequent IPs. Explain how you would implement it in practice (data structures, disk usage, complexity), and how your approach changes if: - Memory is limited to, say, 256MB. - The file is tens/hundreds of GB. - You only need an approximate answer.

Overview: This question evaluates a candidate's competency in large-scale data processing and algorithm design, focusing on memory- and disk-constrained frequency estimation, streaming and approximation concepts.

|Home/Software Engineering Fundamentals/Asana
Asana logo
Asana
Jan 7, 2026
mediumSoftware EngineerOnsiteSoftware Engineering Fundamentals
48
0

You are given a very large log file (too large to fit in memory). Each line contains an IPv4 address (e.g., 203.0.113.7).

Design an approach to answer one of these variants under memory constraints:

  • Variant A: Find the single most frequent IP.
  • Variant B: Find the top K most frequent IPs.

Explain how you would implement it in practice (data structures, disk usage, complexity), and how your approach changes if:

  • Memory is limited to, say, 256MB.
  • The file is tens/hundreds of GB.
  • You only need an approximate answer.
Loading comments...