Diff Cloud Resource Snapshots Into Field-Level Change Events

Last updated: November 29, 2026

Quick Overview

Given two snapshots of a customer's cloud resources (lists of nested dicts keyed by id), emit resource added, removed and modified events, where modified events list each changed field path with old and new values, ignoring volatile fields like last_seen.

Vanta
Coding & Algorithms
Software Engineer
Vanta
November 29, 2026
Software Engineer
Onsite
Coding & Algorithms
Medium

0

0

0 solved


Given two snapshots of a customer's cloud resources (lists of nested dicts keyed by id), emit resource added, removed and modified events, where modified events list each changed field path with old and new values, ignoring volatile fields like last_seen.

Vanta re-syncs each integration on a schedule and needs to tell customers and auditors what changed: a bucket became public, encryption was removed, a user gained admin. The interviewer checks recursive diffing, deterministic output, and judgment about noise (volatile fields, list ordering) that would otherwise flood customers with false alerts.

What the Interviewer Expects
  • Indexes both snapshots by id and classifies added, removed, modified
  • Recursively diffs nested dicts with dotted paths
  • Excludes volatile fields so unchanged resources emit nothing
  • Produces deterministic, sorted output
  • Discusses list semantics (ordered vs set-like) explicitly
Key Topics to Cover
recursion
hash maps
tree diff
change detection
noise reduction
How to Approach This
  1. Clarify input constraints and edge cases before writing code.
  2. Walk through your approach verbally and confirm with the interviewer before coding.
  3. Start with a brute force solution, then optimize. Mention time and space complexity.
  4. Test your solution with examples, including edge cases like empty input or duplicates.
  5. Consider common patterns: sliding window, two pointers, hash map, BFS/DFS, dynamic programming.
Possible Follow-up Questions
  • How do you diff a list of security group rules where order does not matter?
  • Snapshots for a large AWS account have 500k resources. How do you diff without loading both into memory?
  • How would you turn these events into alerts only when a security-relevant field changes?
  • A resource id is reused after deletion. How do you avoid reporting it as modified?
Sharpen Your Skills on Codemia

Practice similar problems with our interactive workspace, get AI feedback, and track your progress.

Practice DSA Problems
Sample Answer
Requirements

Input: before and after lists of resources with an id. Output: ordered events. Modified events carry field-level changes {kind, field, old, new} where kind is added, removed or changed. Fields...

High-Level Design

Build id -> resource maps with volatile keys stripped. The union of ids splits into three cases. For shared ids, recurse: if both values are dicts, walk the union of keys; otherwise compare whole va...


Submit Your Answer
Markdown supported

Related Questions