Datadog Initial Coding Screen - Mid/Senior position - USA

datadog logo
datadog
Mid/SeniorUSA
April 13, 20258 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.

Full Experience

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 !!

Interview Questions (1)

Q1
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.

Discussion (0)

Share your thoughts and ask questions

Join the Discussion

Sign in with Google to share your thoughts and ask questions

No comments yet

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