Plaid interview question
Implement a scheduler that reports bank accounts due for a periodic refresh
- Company:
- Plaid
- Round:
- Technical
- Type:
- Coding
- Difficulty:
- Medium
- Reported:
- June 2, 2026
Problem
Linked bank accounts must be refreshed periodically. Implement RefreshScheduler:
add_account(account_id, interval, now): start tracking an account; it is first due atnow + interval. Adding an existing id replaces its schedule.remove_account(account_id): stop tracking it.tick(now): return the ids of all accounts whose due time is at mostnow, ordered by due time and then by id. Each returned account is rescheduled tonow + interval(missed periods are not reported more than once).
Times are integers and calls arrive with non-decreasing now.
Example 1
Input: add("A", 10, 0), add("B", 15, 0), tick(10), tick(15), tick(20), tick(45)
Output: ["A"], ["B"], ["A"], ["A", "B"]
After tick(20), A is next due at 30; B was rescheduled at 15 to be due at 30. Both are reported at 45, ordered by id because their due times are equal.
Example 2
Input: add("A", 5, 0), remove("A"), tick(100)
Output: []
Removed accounts are never reported.
Constraints
- Up to 10^5 accounts and 10^5 operations.
1 <= interval <= 10^9.
Reported by candidates or drawn from publicly available sources, and rewritten in our own words. Pathwise Prep does not publish confidential assessment content. Report a concern