Three-Way Merge of an Offline Call Report Against the Server

Last updated: November 29, 2026

Quick Overview

A field rep edits a call report offline on an iPad while the same record changes on the server. Given the base version both sides started from, the local version and the server version, produce a field-level merged record and a list of true conflicts.

Veeva Systems
Coding & Algorithms
Software Engineer
Veeva Systems
November 29, 2026
Software Engineer
Onsite
Coding & Algorithms
Medium

0

0

0 solved


A field rep edits a call report offline on an iPad while the same record changes on the server. Given the base version both sides started from, the local version and the server version, produce a field-level merged record and a list of true conflicts.

Vault CRM's mobile apps are built to work offline in hospitals and clinics with poor connectivity, so sync conflict handling is core to the product. The interviewer wants the insight that comparing against a common base distinguishes a change from a stale copy, plus sensible handling of deletes and real conflicts.

What the Interviewer Expects
  • Explains why two-way comparison cannot tell who changed a field and three-way can
  • Merges field by field: one-sided changes win, identical changes are not conflicts
  • Handles fields added or deleted on either side with a sentinel distinct from None
  • Returns conflicts with base, local and server values for a reviewer
  • Discusses the policy for conflicts (server wins provisionally, surface to user)
Key Topics to Cover
three-way merge
offline sync
conflict resolution
sentinel values
mobile data
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
  • Submitted call reports are locked for compliance; how does that change the merge?
  • How would you merge a list field such as products discussed rather than replacing it?
  • How do you obtain the base version on the device, and what if it was lost?
  • Where would vector clocks or per-field timestamps be better than a stored base?
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

Inputs are three dicts: base (last synced copy), local (device edits) and server (current server copy). For each field: unchanged on both sides keeps the value, changed on one side takes that si...

High-Level Design

Iterate over the union of field names. Use a private MISSING sentinel so deletion is a value we can compare. Rules in order: l == s -> take it; l == b -> only server changed; s == b -> only lo...


Submit Your Answer
Markdown supported

Related Questions