Datadog | Onsite | 2024
Anonymous User
5811

Coding 1:
I initialized a buffer of zero length and was calculating length dynamically, but the interviewer wanted me to intialize the buffer with fixed length and have pointers to keep track of buffer usage. He really had a particular way to solve and he didn't let me solve it the way I started.

# Assume we have a File class whose constructor takes a filepath string as an argument. It has a single method called write, which persists bytes directly to disk.

# f = File('/tmp/my/file.txt')
# f.write(b"hello world")
# 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.

# Example usage:

# f = File('/tmp/my/file.txt')
# buf_size = 1000

# b = BufferedFile(f, buf_size)
# b.write(b"hello world")
# b.flush()

Coding 2:
The interviewer didn't give me a proper explanation of what is the problem and what is expected, just gave me the following input and output.. I understood towards the end when I had very little time left that for the logs to be an "M" (match)., all the words in the log should be present in that Query.
For ex - "M: Loading snapshot failed no stacktrace available; Q=2,3,4" is a match with Q 2,3,4 because - "Stacktrace", "loading failed", and "snapshot loading" - each of these words are present in the Log "Loading snapshot failed no stacktrace available".

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",
]

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",
]

System Design - Design a mint like app, but it only had transactions from credit/debit cards and analytics and notification if transaction goes over a threshold.

I did solve both coding, but I was sent a rejection email the very next day. Recruiter said I didn't meet their expectation with SD and behavioral.

Comments (20)