← Navan Interview Insights

Navan·Software Engineer·Technical Phone Screen·Intermediate

IntermediatePrefer not to say
May 2026

Summary

Interviewed for a software engineer role at Navan and got a data structures problem that looked simple on the surface but had a few wrinkles worth thinking through. Clean problem, reasonable expectations.

Questions Asked (1)

Q1

Design an in-memory key-value store that supports time-based lookups. It should handle set(key, value, timestamp) and get(key, timestamp), where get returns the value at the largest stored timestamp that doesn't exceed the queried one.

Algorithms & Data StructuresSystem Design
Author's notes

My first instinct was a plain hashmap and I started going that direction before realizing get() needed something smarter than a linear scan.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Clarify requirements and constraints, then propose a design using a hash map from keys to time-ordered structures (e.g., sorted list or balanced BST) to support efficient timestamp-based lookups. Discuss trade-offs between different data structures and algorithms, and consider edge cases and scalability.

Pro tip: Mention that timestamps are monotonically increasing per key in typical use cases, allowing append-only structures and binary search for O(log n) lookups. Also, discuss how to handle out-of-order writes if they are allowed.

1. Clarify Requirements

Ask about expected operations, data volume, timestamp ordering, concurrency, and persistence needs. Confirm whether timestamps are unique per key and if out-of-order writes are allowed.

2. Choose Data Structures

Propose a hash map for key lookup, with each key mapping to a time-ordered collection (e.g., dynamic array, balanced BST, or skip list) for efficient timestamp-based retrieval.

3. Design Operations

For set, append or insert the (timestamp, value) pair; for get, perform binary search to find the largest timestamp ≤ query timestamp. Discuss time complexities: O(1) average for set, O(log n) for get.

4. Handle Edge Cases

Address cases like missing key, no timestamp ≤ query, duplicate timestamps, and out-of-order writes. Explain how the design handles them.

5. Discuss Optimizations and Trade-offs

Compare alternatives (e.g., B-tree, skip list) and mention concurrency, memory usage, and potential for caching or compression.

Key Points to Mention

  • Hash map for O(1) key lookup
  • Time-ordered structure per key (e.g., sorted array, balanced BST)
  • Binary search for O(log n) get operation
  • Handling out-of-order timestamps (if allowed)
  • Time and space complexity analysis
  • Concurrency and scalability considerations

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