Your question is Offline Sync with Conflict Resolution. Start with the requirements on the right.
Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.
Design a function that merges offline mobile actions into server state. Each action has an item_id, operation type, timestamp, and op_id; duplicate retries must be ignored, the merge order must be deterministic, and conflicting items must be returned separately.
local_ops: list of (item_id, op_type, timestamp, op_id)server_state: current item state before syncremote_changes: list of (item_id, op_type, timestamp)(final_state, conflicts)op_id values