Implement filters and cursor pagination
Company: Coinbase
Role: Software Engineer
Category: Data Manipulation (SQL/Python)
Difficulty: Medium
Interview Round: Onsite
Design and implement a transaction query module over a dataset or database where each transaction has startDate, endDate, userId, and amount. Requirements:
(
1) Provide per-field filters exposed via setter methods (e.g., setDateRange(start, end), setUserId(id), setAmountRange(min, max)); filters combine conjunctively.
(
2) Implement cursor-based pagination: given pageSize and an optional opaque cursor, return exactly pageSize matching transactions and a next cursor. Assume you can call a DB. Specify the stable sort keys used for pagination, define and encode the cursor, handle empty pages and end-of-results, address inserts/updates between requests, and provide code-level API signatures plus complexity analysis.
Quick Answer: This question evaluates a candidate's ability to design and implement cursor-based pagination, conjunctive per-field filtering, stable sort key selection, API surface design, and complexity analysis for a database-backed transaction query module.