datadog logo
Datadog· Mid/Senior

Datadog Initial Coding Screen - Mid/Senior position - USA

Location
USA
Posted
13 Apr 2025
365 reads

Summary

I had an initial coding screen for a Mid/Senior position at Datadog in USA, where I was asked to implement a solution similar to rm -rf. I solved it using a recursive DFS approach and then optimized it to an iterative BFS approach to handle OOM issues for wide file structures, successfully moving to the next round.

How it went

I got the same question as this one:

https://leetcode.com/discuss/post/4159607/datadog-onsite-rm-rf-by-anonymous_user-e3bf/

  • I was asked to implement a solution. I implemented a recursive DFS solution.
  • The follow up was to update the code to avoid OOM issue.
    • I suggested that we can use an iterative approach instead of recursion.
    • We had an in depth discussion on why a recursive solution can cause OOM issue.
    • The Interviewer followed up with sharing that file structure is not deep but rather wide. Say max directory depth is only 10 but the number of files in the directory are in millions.
    • I suggested a BFS based approach. The Interviewer was happy with the approach and implementation.
  • I am moving on to the next round !!

Questions asked (1)

  1. 01

    File System Deletion (rm -rf style) with OOM Handling

    Data Structures & Algorithms

    The problem involved implementing a file system deletion mechanism similar to rm -rf. I initially implemented a recursive DFS solution. The follow-up challenged me to update the code to avoid Out Of Memory (OOM) issues, especially considering a file structure that is wide (millions of files in a directory) rather than deep (max directory depth of 10). This led to a discussion about recursive versus iterative approaches and eventually suggesting a BFS-based approach for efficiency.

    Open the problem

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!