← eBay Interview Insights

eBay·Software Engineer·Technical Phone Screen·Intermediate

IntermediatePrefer not to say
Jun 2026

Summary

eBay SWE interview that focused on extending a file system design with a copy operation. Pretty focused scope but the edge cases were where things got interesting.

Questions Asked (1)

Q1

You have a file system backed by a path-to-metadata map and per-user usage counters. Add a copyFile(fromName, toName) operation that returns false if the source doesn't exist, if the destination already exists, or if copying would push the source file's owner over their storage capacity. Otherwise copy the file metadata and return true. Walk through your data structures and the complexity.

System DesignAlgorithms & Data StructuresTechnical Trade-offs
Author's notes

The basic logic was fine, check existence, check collision, copy metadata.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by restating the problem and clarifying assumptions about the data structures (e.g., hash map for path-to-metadata, hash map for user usage). Then walk through the copyFile operation step by step, checking existence, destination, and capacity, and finally discuss time and space complexity. Emphasize trade-offs and potential optimizations.

Pro tip: Mention that the operation should be atomic or thread-safe if concurrent access is possible, and discuss how to handle metadata copying (deep vs shallow) to avoid unintended sharing.

1. Clarify requirements and assumptions

Confirm the data structures: a hash map for path-to-metadata and a hash map for per-user usage counters. Ask about concurrency, file size, and whether metadata includes owner and size.

2. Outline the algorithm

Check if source exists, destination does not exist, and owner's usage + file size <= capacity. If all pass, copy metadata to destination and update owner's usage; return true. Otherwise return false.

3. Analyze complexity

Time complexity is O(1) for hash map lookups and updates, assuming average case. Space complexity is O(1) additional, as we only copy metadata (which may be O(1) if metadata is a small object).

4. Discuss edge cases and optimizations

Consider concurrency (locking), atomicity, and whether to copy file content or just metadata. Mention potential optimizations like caching or sharding if the map grows large.

Key Points to Mention

  • Use of hash maps for O(1) average-case lookups and updates.
  • Check order: source existence, destination absence, capacity check.
  • Capacity check: owner's current usage + source file size <= capacity.
  • Update owner's usage counter after successful copy.
  • Time and space complexity: O(1) time, O(1) space (metadata copy).
  • Concurrency considerations: locking or atomic operations if needed.

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