← Amazon Interview Insights

Amazon·Software Engineer·Onsite - System Design / Architecture·Senior

Senior
Jun 2026

Summary

Amazon system design round for a software engineering role. The whole thing was one big question about designing a filesystem search tool from scratch, and they wanted a lot of detail on basically every dimension you can think of.

Questions Asked (1)

Q1

Design an object-oriented module that replicates the behavior of the UNIX 'find' command. It should support filtering by name patterns, file type, size ranges, timestamps, permissions, and depth limits. Predicates should be composable with AND/OR/NOT logic. Cover symlink handling, output options, extensibility, traversal performance, and robustness under permission errors or very large directories. Include class interfaces, key data structures, and test cases.

System DesignTechnical Trade-offsAPI & Integrations
Author's notes

This question is basically a full design session compressed into one prompt.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying requirements and defining the core abstractions: a FileSystemEntry interface, a Predicate hierarchy with composite AND/OR/NOT, and a FileFinder that traverses directories using a visitor pattern. Then discuss traversal strategies (BFS/DFS, symlink handling, depth limits), performance optimizations (streaming, pruning, concurrency), and robustness (error handling, permission issues). Finally, outline extensibility points, output formatting, and test cases covering edge conditions.

Pro tip: Emphasize the importance of lazy evaluation and short-circuiting in predicate composition to avoid unnecessary I/O, and mention how you would handle symlink cycles to prevent infinite loops—these details show production-level maturity.

1. Clarify Requirements and Scope

Ask about expected scale (millions of files?), supported file systems, symlink semantics (follow or not?), and output formats. Confirm whether concurrency is needed and how errors should be reported.

2. Design Core Interfaces and Data Structures

Define FileSystemEntry (path, type, size, timestamps, permissions), Predicate interface with matches(entry), and composite predicates (AndPredicate, OrPredicate, NotPredicate). Outline FileFinder with options like maxDepth, followSymlinks, and errorHandler.

3. Implement Traversal and Filtering

Choose traversal strategy (DFS with stack or BFS with queue), apply predicates during traversal to prune early, and handle symlinks by tracking visited inodes to avoid cycles. Use streaming to avoid loading entire directory trees into memory.

4. Address Performance and Robustness

Discuss optimizations: parallel traversal with thread pool, caching file attributes, and using OS-level APIs (e.g., readdir). Handle permission errors gracefully via error handler, and ensure large directories don't cause memory issues by processing entries incrementally.

5. Extensibility, Output, and Testing

Show how to add new predicates (e.g., regex name match) via the Predicate interface, and output formatters (plain, JSON, custom). Outline test cases: unit tests for predicates, integration tests for traversal with symlinks, permission-denied scenarios, and performance tests with large directories.

Key Points to Mention

  • Composable predicates using the Composite pattern with short-circuit evaluation for AND/OR.
  • Symlink handling: follow vs. not follow, cycle detection via visited inode set, and depth limit interaction.
  • Traversal performance: iterative DFS/BFS to avoid stack overflow, pruning with predicates, and optional parallel traversal.
  • Robustness: error handling strategy (skip, log, abort), permission errors, and handling of very large directories via streaming.
  • Extensibility: plugin architecture for new predicates and output formatters, possibly using factories or registries.
  • Test cases: unit tests for each predicate and composite logic, integration tests for symlinks and permissions, and stress tests for large directories.

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