← Adobe Interview Insights

Adobe·Software Engineer·Technical Phone Screen·Intermediate

Intermediate
Jun 2026

Summary

Adobe full-stack round, one coding question the whole time. They gave me a Node.js filesystem problem and just let me run with it, which I wasn't expecting to be as tricky as it turned out.

Questions Asked (1)

Q1

Using Node.js, write a function that takes a file path and recursively reads all files and subdirectories under it, then prints the directory structure as an indented tree.

Algorithms & Data StructuresTechnical Trade-offsAPI & Integrations
Author's notes

I went straight for the sync version with readdirSync and statSync because I didn't want to fumble async error handling under pressure.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying requirements (e.g., symlinks, hidden files, error handling) and then outline a recursive solution using fs.promises.readdir with withFileTypes to avoid extra stat calls. Implement the function with proper indentation and discuss trade-offs between synchronous and asynchronous approaches.

Pro tip: Mention that using fs.promises and async/await prevents blocking the event loop, which is crucial for scalability in Node.js applications. Also, consider using a stack-based iterative approach to avoid stack overflow for very deep directory trees.

1. Clarify Requirements and Edge Cases

Ask about handling symlinks, hidden files, permission errors, and whether the output should be sorted. This shows attention to detail and prevents assumptions.

2. Choose Asynchronous vs Synchronous

Decide between fs.promises (async) and fs.readdirSync (sync). Async is preferred for non-blocking I/O, but sync may be simpler for small scripts. Explain your choice.

3. Implement Recursive Traversal

Use fs.promises.readdir with { withFileTypes: true } to get Dirent objects, then recursively process directories. Maintain an indentation level for printing.

4. Handle Errors and Edge Cases

Wrap file operations in try/catch to handle permission errors or missing paths. Decide whether to skip or throw errors, and mention this in your solution.

5. Test and Optimize

Walk through a sample directory structure to verify correctness. Discuss potential optimizations like concurrency control or iterative traversal for deep trees.

Key Points to Mention

  • Use of fs.promises.readdir with withFileTypes to avoid separate stat calls
  • Asynchronous vs synchronous trade-offs: non-blocking I/O vs simplicity
  • Error handling for permission issues and non-existent paths
  • Indentation logic for tree structure (e.g., using depth level)
  • Handling of symlinks to prevent infinite loops
  • Potential stack overflow with deep recursion and iterative alternative

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.