Techscreen: https://leetcode.com/discuss/interview-question/6375931/Datadog-tech-screening
Interview Loop
Total rounds- 5
Interview date- Aug 2024
Region- US
2 Coding rounds - (60 min each) (Interviewers' participation was almost zero, I was presented the problem statement and asked to implement, no explanation was provided by the interviewer. Problem statement is a bit on the verbose side so make sure that you read it carefully and ask clarifying questions. At the end, the interviewers only executed test cases. There was hardly any discussion about my thought process or the approach that I had chosen)
1 System Design round - (60 min) Design a mint like budgeting app, but it only had transactions from credit/debit cards and analytics and notification if transaction goes over a threshold.
1 Value based interview - (45 min) Questions on the similar lines to Amazon's leadership principles
1 Deep dive technical experience - (45 min) By a senior engineer, discussion about the past projects and your role.
Verdict: Reject (Did not clear System Design as per the feedback from recruiter which I knew I had flunked)
Coding Questions
I was able to implement and run test cases for both the rounds except for the follow up.
Round 1: Implement a BufferedFileWriter class
Write a wrapper class for the file object which allows us to buffer the writes in-memory. The wrapper class, BufferedFile is initialized with a File class object and a buffer size. It has two methods: write and flush. The data should be flushed to disk when the buffer is full, or on demand with a method called flush. All bytes must be stored in the buffer first before being written to disk. The buffer cannot use more memory than the max bytes allowed.
interface FileOut {
// Writes the whole buffer to file
int write(char[] buf);
}
Follow up:- What if the write method is changed to write only given number of bytes e.g. write(char[] buf, int numBytes). You need to make the array you are using as a buffer a circular array. Could not fully implement the followup, but the interviewer agreed with the circular array approach.
Round 2: Parse query L, Q and show matching q in list of logs. Similar to https://leetcode.com/discuss/interview-question/2639509/DataDog-Interview-Question
Pay close attention to hadnling the case of the text (upper/lower), I missed that in the problem statement and had to spend some time to figure that out.
Input
// livetail_stream = [
// "Q: database",
// "Q: Stacktrace",
// "Q: loading failed",
// "L: Database service started",
// "Q: snapshot loading",
// "Q: fail",
// "L: Started processing events",
// "L: Loading main DB snapshot",
// "L: Loading snapshot failed no stacktrace available",
// ]Expected Output
// livetail_output = [
// "ACK: database; ID=1",
// "ACK: Stacktrace; ID=2",
// "ACK: loading failed; ID=3",
// "M: Database service started; Q=1",
// "ACK: snapshot loading; ID=4",
// "ACK: fail; ID=5",
// "M: Loading main DB snapshot; Q=4",
// "M: Loading snapshot failed no stacktrace available; Q=2,3,4",
// ]