Implement banking ops: transfer, top-k, cashback, merge
Company: Coinbase
Role: Software Engineer
Category: Coding & Algorithms
Difficulty: Medium
Interview Round: Take-home Project
Quick Answer: This question evaluates a candidate's ability to design a robust in-memory banking system, covering transactional correctness, idempotency, concurrency control, delayed cashback scheduling, aggregate top-k queries, and data structure and complexity trade-offs within the Coding & Algorithms domain.
Constraints
- Inputs are provided as Python literals compatible with the function signature.
- Return a deterministic value exactly matching the requested output.
Examples
Input: ([['create','a'], ['create','b'], ['deposit','a',100], ['transfer','a','b',40], ['top',2], ['cashback','a',5], ['merge','b','a'], ['top',2]],)
Expected Output: [True, True, 100, True, ['a', 'b'], 65, True, ['a']]
Explanation: Transfer ranking, cashback, merge.
Input: ([['deposit','missing',10], ['create','x'], ['transfer','x','x',1], ['top',3]],)
Expected Output: [None, True, False, ['x']]
Explanation: Invalid cases.
Input: ([['create','b'], ['create','a'], ['deposit','b',50], ['deposit','a',50], ['transfer','b','a',10], ['transfer','a','b',10], ['top',2]],)
Expected Output: [True, True, 50, 50, True, True, ['a', 'b']]
Explanation: Tie in outgoing volume.
Hints
- Start with a direct data structure representation.
- Handle edge cases before the main loop.