Replay a Card Dispute Through Its Allowed State Transitions

Last updated: November 29, 2026

Quick Overview

Model a card dispute as a state machine (filed, provisional credit, awaiting merchant, in review, won, lost, withdrawn). Given a dispute's day-stamped events, return its final state or the first invalid event, where a merchant that does not respond within 30 days loses automatically.

Capital One
Coding & Algorithms
Software Engineer
Capital One
November 29, 2026
Software Engineer
Technical Screen
Coding & Algorithms
Medium

0

0

0 solved


Model a card dispute as a state machine (filed, provisional credit, awaiting merchant, in review, won, lost, withdrawn). Given a dispute's day-stamped events, return its final state or the first invalid event, where a merchant that does not respond within 30 days loses automatically.

Disputes are a large operational workflow for Capital One's card business, with regulatory timelines around provisional credit and merchant response windows. The screen checks whether you represent states and transitions explicitly as data, reject illegal moves, and model a time-driven transition rather than only event-driven ones.

What the Interviewer Expects
  • Represent transitions as a table rather than nested if statements
  • Reject any event not allowed in the current state
  • Treat won, lost and withdrawn as terminal
  • Apply the merchant deadline as a time-triggered transition
  • Return a clear error naming the offending event
Key Topics to Cover
State machines
Simulation
Transition tables
Validation
Time-based events
How to Approach This
  1. Clarify input constraints and edge cases before writing code.
  2. Walk through your approach verbally and confirm with the interviewer before coding.
  3. Start with a brute force solution, then optimize. Mention time and space complexity.
  4. Test your solution with examples, including edge cases like empty input or duplicates.
  5. Consider common patterns: sliding window, two pointers, hash map, BFS/DFS, dynamic programming.
Possible Follow-up Questions
  • How would you also enforce that provisional credit is issued within 10 business days of filing?
  • How would you persist dispute state so that replays and live processing agree?
  • How would you support a second-cycle pre-arbitration step after a loss?
  • How would you test every transition and make sure none are missing?
Sharpen Your Skills on Codemia

Practice similar problems with our interactive workspace, get AI feedback, and track your progress.

Practice DSA Problems
Sample Answer
Requirements
  • States: FILED, CREDITED, AWAITING_MERCHANT, IN_REVIEW, WON, LOST, WITHDRAWN.
  • Events arrive in day order. Unknown or disallowed events stop the replay with an error.
  • If more than 30 days pass in ...
High-Level Design

Store a dict keyed by (state, action) that gives the next state. Replay events in order: first fire any time-driven transition by comparing the event day with the day the dispute entered AWAITING_ME...


Submit Your Answer
Markdown supported