← eBay Interview Insights

eBay·Software Engineer·Technical Phone Screen·Intermediate

Intermediate
May 2026

Summary

eBay software engineer interview that focused on extending an in-memory file system with a search operation. The coding part was straightforward enough but the design discussion at the end is where things got interesting.

Questions Asked (2)

Q1

You have an in-memory file system with addFile, getFileSize, and deleteFile already implemented. Add a findFiles(prefix, suffix) method that returns all matching file names formatted as 'name(size)', sorted by size descending and then alphabetically for ties.

Algorithms & Data StructuresSystem Design
Author's notes

Spent the first few minutes just making sure I understood the output format correctly because 'name(size)' is easy to get wrong under pressure.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

First, clarify the requirements and constraints, such as whether the file system is a trie or hash map, and whether findFiles should be case-sensitive. Then, propose an efficient data structure (e.g., a trie for prefix search) and outline the algorithm: traverse the trie to the prefix node, collect all files in the subtree, filter by suffix, and sort the results by size descending and name ascending. Finally, discuss time and space complexity and potential optimizations like caching or indexing.

Pro tip: Mention that you would store file metadata (name, size) in the trie nodes and use a custom comparator for sorting to handle ties correctly. Also, consider edge cases like empty prefix/suffix and duplicate file names.

1. Clarify Requirements

Ask about the file system implementation (e.g., trie, hash map), whether file names are unique, case sensitivity, and expected input sizes to determine the optimal approach.

2. Choose Data Structure

If not already implemented, suggest using a trie for efficient prefix search, with each node storing a list of files (or file metadata) that end at that node. Alternatively, if the system uses a hash map, discuss iterating over all files.

3. Design Algorithm

Traverse the trie to the node representing the prefix, then perform DFS to collect all files in the subtree. Filter files by suffix, and sort the results by size descending and then name ascending.

4. Analyze Complexity

Calculate time complexity: O(P + K + M log M) where P is prefix length, K is number of nodes in subtree, and M is number of matching files. Space complexity: O(M) for storing results.

5. Discuss Optimizations

Mention potential improvements like caching frequent queries, using a balanced BST for sorted results, or maintaining a separate index for suffixes if suffix filtering is common.

Key Points to Mention

  • Trie data structure for efficient prefix matching
  • DFS traversal to collect files under prefix node
  • Suffix filtering after prefix match
  • Custom comparator for sorting by size descending and name ascending
  • Time and space complexity analysis
  • Edge cases: empty prefix/suffix, no matches, duplicate names

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

Q2

Is a linear scan good enough for this file system at scale, or would you consider building a trie or suffix index? Walk through the trade-offs.

Technical Trade-offsAlgorithms & Data StructuresSystem Design
Author's notes

This is where I felt underprepared.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying the scale and access patterns (e.g., file count, query frequency, read/write ratio) to ground the discussion. Then compare linear scan, trie, and suffix index across time/space complexity, implementation complexity, and operational overhead. Conclude with a pragmatic recommendation that balances current needs with future scalability, possibly suggesting a hybrid or phased approach.

Pro tip: Emphasize that the right choice depends on the workload: linear scan is fine for small or infrequent queries, but for high-throughput prefix or substring searches, an index is worth the complexity. Also mention that you'd prototype and measure before committing to a complex solution.

1. Clarify Requirements

Ask about the scale (number of files, average file size), query patterns (exact match, prefix, substring, regex), and performance SLAs (latency, throughput).

2. Analyze Linear Scan

Discuss its simplicity and low overhead, but highlight O(n) per query and poor scalability for large datasets or frequent searches.

3. Evaluate Trie and Suffix Index

Explain that a trie excels for prefix searches with O(k) lookup (k = key length) but uses significant memory; a suffix index (e.g., suffix tree/array) supports substring queries but has higher build cost and complexity.

4. Compare Trade-offs

Weigh time/space complexity, implementation effort, maintenance, and update costs (e.g., dynamic inserts/deletes). Consider hybrid approaches like in-memory indexes with periodic rebuilds.

5. Recommend and Justify

Propose a solution based on the clarified requirements, e.g., start with linear scan for MVP, then introduce a trie for prefix-heavy workloads or a suffix index for substring search if justified by metrics.

Key Points to Mention

  • Time complexity: linear scan O(n) per query vs. trie O(k) for prefix vs. suffix index O(m) for substring (m = pattern length).
  • Space complexity: linear scan O(1) extra; trie O(total characters) but with high constant; suffix index O(n) to O(n log n) depending on implementation.
  • Implementation and maintenance complexity: linear scan trivial; trie moderate; suffix index complex (e.g., Ukkonen's algorithm).
  • Update costs: dynamic inserts/deletes are easy for linear scan, harder for tries (especially with compression), and very hard for suffix indexes.
  • Use cases: linear scan for small or infrequent queries; trie for autocomplete/prefix search; suffix index for full-text search or substring matching.
  • Hybrid or phased approach: start simple, measure, then optimize with caching or indexing as needed.

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