DataDog Tech Screen India

Location
India
Posted
21 Apr 2025
345 reads

Summary

I had a technical screen with DataDog in India where I was asked to implement a function to count packets with a specific label within a sliding window.

How it went

You're given two arrays:

  • timestamps[] representing the arrival times of packets,
  • labels[] representing the tag or category of each packet.

You’re also given:

  • a string target_label, and
  • an integer window_size.

Write a function that returns an array of integers representing the count of packets with the given target_label in each sliding window of size window_size seconds. The sliding window should move one second at a time, and the counts should reflect how many packets with target_label fall within each window.

Something like the following

timestamps = [2, 4, 5, 8, 10]
labels = ["x", "y", "x", "x", "y"]
target_label = "x"
duration = 3

There was one more follow up along the same lines!

Questions asked (1)

  1. 01

    Sliding Window Packet Count by Label

    Data Structures & Algorithms · Medium

    You're given two arrays:

    • timestamps[] representing the arrival times of packets,
    • labels[] representing the tag or category of each packet.

    You’re also given:

    • a string target_label, and
    • an integer window_size.

    Write a function that returns an array of integers representing the count of packets with the given target_label in each sliding window of size window_size seconds. The sliding window should move one second at a time, and the counts should reflect how many packets with target_label fall within each window.

    Something like the following
    
    timestamps = [2, 4, 5, 8, 10]
    labels = ["x", "y", "x", "x", "y"]
    target_label = "x"
    duration = 3
    
    

Know someone preparing? Send it to them:WhatsAppLinkedInX

Interviewed at Datadog recently?

Write up your rounds while you still remember the questions. It helps the next person more than you would think.

Share your experience
Discussion 0

Questions for the author, or how your own interview compared.

Join the discussion

Sign in with Google to comment or ask the author a question.

No comments yet

Be the first to share your thoughts and start the discussion!