← eBay Interview Insights

eBay·Software Engineer·Technical Phone Screen·Intermediate

Intermediate
Jun 2026

Summary

eBay software engineer interview with a coding round focused on designing an in-memory file system from scratch. Pretty straightforward concept but the follow-up discussion on data structures made it more interesting than I expected.

Questions Asked (1)

Q1

Design an in-memory file system where each file has a name and size. Implement addFile, getFileSize, deleteFile, and listFiles operations. listFiles should return entries formatted as 'name(size)', sorted by size descending with ties broken alphabetically.

Algorithms & Data StructuresSystem DesignTechnical Trade-offs
Author's notes

The CRUD operations were easy enough with a hash map, O(1) for everything.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying requirements and constraints, then propose a data structure like a hash map for O(1) file operations and a sorted list or heap for efficient listing. Discuss trade-offs between different approaches and explain how to maintain sorted order for listFiles.

Pro tip: Mention that you would keep the file list sorted incrementally or use a balanced tree to avoid sorting on every listFiles call, showing awareness of performance under frequent operations.

1. Clarify Requirements

Ask about expected file sizes, frequency of operations, and whether duplicate names are allowed. Confirm the exact sorting rules and output format.

2. Choose Data Structures

Propose a hash map for O(1) add, get, and delete, and a sorted data structure (e.g., balanced BST or skip list) for listFiles to maintain order efficiently.

3. Implement Operations

Detail how each operation works: addFile inserts into both structures, getFileSize looks up the map, deleteFile removes from both, and listFiles traverses the sorted structure.

4. Handle Sorting and Ties

Explain how to sort by size descending and break ties alphabetically, either by custom comparator or by maintaining order during insertion.

5. Analyze Complexity and Trade-offs

Discuss time and space complexity for each operation and compare alternatives (e.g., sorting on demand vs. maintaining sorted order).

Key Points to Mention

  • Use a hash map for O(1) average-case add, get, and delete operations.
  • Maintain a sorted collection (e.g., balanced BST, skip list, or sorted list) for efficient listFiles.
  • Custom comparator: sort by size descending, then name ascending for ties.
  • Time complexity: O(1) for add/get/delete, O(n) for listFiles if traversing sorted structure, or O(n log n) if sorting on demand.
  • Space complexity: O(n) for storing n files.
  • Trade-offs: sorting on demand is simpler but slower for frequent listFiles; maintaining sorted order adds insertion overhead but speeds up listing.

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