Compute Changed Byte Ranges Between Two Snapshot Extent Maps
Last updated: November 29, 2026
Quick Overview
Each snapshot of a vdisk is a sorted, non-overlapping list of (start, length, extent_id) mappings, with gaps meaning unallocated. Return the merged list of [start, end) ranges where the two snapshots map to different extents, which is what an incremental backup must copy.
Nutanix
November 29, 20260
0
0 solved
Each snapshot of a vdisk is a sorted, non-overlapping list of (start, length, extent_id) mappings, with gaps meaning unallocated. Return the merged list of [start, end) ranges where the two snapshots map to different extents, which is what an incremental backup must copy.
Backup vendors integrate with Nutanix through changed region tracking APIs, and asynchronous replication ships only the delta between two snapshots of a protected VM. The interviewer wants a correct sweep over interval boundaries plus merging of adjacent results, without materializing per-block bitmaps for multi-terabyte disks.
What the Interviewer Expects
- Sweeps over the union of all interval boundaries
- Advances two pointers instead of searching each segment
- Treats allocated versus unallocated as a change
- Merges adjacent changed segments into maximal ranges
- Avoids per-block expansion so cost depends on extent count, not disk size
Key Topics to Cover
How to Approach This
- Clarify input constraints and edge cases before writing code.
- Walk through your approach verbally and confirm with the interviewer before coding.
- Start with a brute force solution, then optimize. Mention time and space complexity.
- Test your solution with examples, including edge cases like empty input or duplicates.
- Consider common patterns: sliding window, two pointers, hash map, BFS/DFS, dynamic programming.
Possible Follow-up Questions
- The same extent_id can be referenced at different offsets. What must you compare instead?
- How would you compute the diff between snapshots that are ten generations apart in a chain?
- Ranges must be copied in 1 MiB aligned chunks. How do you post-process the output?
- How would you parallelize this for a 64 TiB vdisk?
Sharpen Your Skills on Codemia
Practice similar problems with our interactive workspace, get AI feedback, and track your progress.
Practice DSA ProblemsSample Answer
Requirements
Inputs old and new are sorted by start and non-overlapping. A byte is changed if its backing extent id differs, including one side unallocated. Output: sorted, merged, half-open ranges. Zero-lengt...
High-Level Design
Collect every start and end from both maps into a sorted list of points. Between consecutive points nothing changes on either side, so each elementary segment has a single extent id per snapshot (or n...