Google swe sre Onsite round 1

google logo
google
swe sre
December 9, 202521 reads

Summary

I had an onsite interview for the SRE role at Google, where I was tasked with designing and implementing file system utility functions, including a crucial follow-up to delete an entire directory tree.

Full Experience

I recently had my first onsite interview round for the Software Engineer, Site Reliability Engineer (SRE) role at Google. The interview focused heavily on file system operations and design. I was initially asked to implement several core file system utility functions, which served as building blocks for a more complex problem. The primary challenge involved efficiently deleting a directory tree.

Interview Questions (2)

Q1
File System Utility Functions
Data Structures & Algorithms

Implement the following file system utility functions which could be used to interact with a file system:

  • fs.GetDirectoryChildren(path): Given a path to a directory, return a list of its immediate children (files and subdirectories).
  • fs.Delete(path): Delete a file or an empty directory at the given path.
  • bool fs.IsDirectory(path): Determine if the given path corresponds to a directory.

Q2
Delete Directory Tree
Data Structures & Algorithms

As a follow-up, implement the function deleteDirectoryTree(path). This function should recursively delete a directory and all its contents (subdirectories and files) starting from the given path. You should leverage the previously defined file system utility functions like GetDirectoryChildren, Delete, and IsDirectory to achieve this efficiently.

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!