Question
You are sharding keys across a cluster using a consistent-hashing ring with virtual nodes. Each physical node owns `vnodes` virtual points on a ring of size `ring_size`; a virtual point for node `n` at replica index `r` is placed at position `(hash31(n + '#' + str(r))) % ring_size`, where `hash31` is the deterministic FNV-1a-style hash given in the reference. A key is placed at `hash31(key) % ring_size` and is owned by the first virtual point found scanning clockwise (increasing position, wrapping past the end). Given the initial node list, a sequence of operations (each either ['add', node] or ['remove', node]), and a list of keys to look up AFTER all operations are applied, return the owning physical node for each key in order.
ring_owners(nodes: list[str], vnodes: int, ring_size: int, ops: list[list], keys: list[str]) → list[str][["A","B","C"],3,1024,[],["user:1","user:2","user:3"]]out["B","A","A"]State your approach and its time/space complexity out loud before you optimize. Handle the edge cases (empty input, duplicates, overflow), and say why you chose this over the brute force. Green tests are the floor, not the grade.
Vibe coding: describe the solution in plain language (or narrate it) and the coach grades your approach. Generating runnable code from your description is coming next.