FastPrepParse and Filter Chargeback Disputes
Problems/Parse and Filter Chargeback Disputes

Parse and Filter Chargeback Disputes

Stripe logoStripe● MediumNEW GRADINTERNOA

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: Reported in a Stripe online assessment. The layout of the dated files, the currency format, the filtering of rows, and the rules for a later withdrawal follow the source. We chose the limits for numbers and text, what happens with a repeated normal row, and the order for tied output. Our version is about 90% the same as the reported question.

Implement parseChargebacks(rows) to parse dated network chargeback files, ignore invalid data rows, and remove disputes withdrawn in a strictly later file. Return the remaining dispute rows. The requirements build on one another: Part 1 parses and formats valid records; Part 2 filters invalid records; Part 3 also handles withdrawals. Implement the complete Part 3 behavior.

File layout

The array flattens 1 through 10 files. Each file begins with NETWORK_yyyymmdd.csv, then a header, then at most 50 data rows. NETWORK is always uppercase and is one of VISA, PAYPAL, AMEX, or JCB. Files may appear in any date order. A new filename starts the next file.

Every header contains exactly these six names in any order:

transaction,merchant,amount,currency,evidence_due_by,reason

Interpret each data row using its own file's header. transaction identifies the disputed transaction on that network; merchant identifies its merchant; amount is in minor currency units; currency is the currency code; evidence_due_by is the merchant's evidence deadline as a UNIX timestamp; reason identifies the reason for the dispute.

Invalid rows

Ignore a data row if its currency is unsupported, its amount is not a positive integer, or its evidence deadline is not a whole number. Supported currencies are EUR, USD, SGD, BRL, JPY, ISK, and KRW. Ignore only that row.

Here, a whole-number field must be a nonempty sequence of ASCII digits. Leading zeros are allowed. A valid amount is from 1 through 1000000000, and a valid deadline is from 0 through 9223372036854775807, inclusive. Out-of-range values are invalid. Do not trim fields; signs, spaces, and decimal points are not digits.

Withdrawals

A valid row whose reason is exactly withdrawn is a withdrawal; every other valid row is a normal dispute. A valid withdrawal cancels a normal dispute only when their network and transaction ID match and the withdrawal's filename date is strictly later than the normal row's filename date. The evidence deadline and the order of files in the array do not determine cancellation.

An invalid withdrawal, or a withdrawal with no earlier matching normal dispute on that network, is ignored. An earlier or same-date withdrawal does not cancel a normal dispute. If both rows are invalid, ignore both. Never return a withdrawal row.

A transaction may appear in at most two files for each network and may be withdrawn at most once. Here, repeated normal rows within a file are allowed: keep every valid normal row unless a qualifying withdrawal cancels it. A withdrawal can therefore cancel several earlier normal rows.

Output

Return one string for each surviving normal row, with four comma-separated fields in this order:

dispute_id,merchant,value,evidence_due_by
  • dispute_id concatenates the uppercase network and the original transaction ID without a separator.
  • Copy the merchant and the deadline text from that normal row exactly, including any leading zeros in the deadline.
  • For EUR, USD, SGD, and BRL, divide the amount by 100 to get major units. For JPY, ISK, and KRW, one minor unit is one major unit.
  • Always use a period and exactly two digits after it, then append the currency code. For example, 1 minor unit becomes 0.01USD or 1.00JPY.

Sort by the concatenated dispute ID in ascending lexicographic order. Here, equal IDs preserve the original data-row order. Return an empty array if no normal disputes remain.

Function

parseChargebacks(rows: String[]) → String[]

Examples

Example 1

rows = ["VISA_20230601.csv","transaction,merchant,amount,currency,evidence_due_by,reason","123890132,47821,37906,USD,1686812400,fraudulent","110450953,63724,12750,JPY,1686898800,duplicate","JCB_20230604.csv","transaction,merchant,currency,amount,evidence_due_by,reason","110450953,11000,SGD,15000,1686898820,duplicate"]return = ["JCB110450953,11000,150.00SGD,1686898820","VISA110450953,63724,12750.00JPY,1686898800","VISA123890132,47821,379.06USD,1686812400"]

The second file reorders currency and amount. The values are 150.00SGD, 12750.00JPY, and 379.06USD. Sort the results by the concatenated dispute ID.

Example 2

rows = ["VISA_20230601.csv","transaction,merchant,amount,currency,evidence_due_by,reason","123890132,47821,37906,USD,1686812400,fraudulent","110450953,63724,12750,CAD,1686898800,duplicate","138843997,57101,99.95,EUR,1686898800,product_not_received"]return = ["VISA123890132,47821,379.06USD,1686812400"]

CAD is unsupported, and 99.95 is not a whole-number amount. Ignore those rows independently; only the valid USD dispute remains.

Example 3

rows = ["VISA_20230602.csv","transaction,merchant,amount,currency,evidence_due_by,reason","123890132,47821,37906,USD,1668812400,fraudulent","110450953,63724,12750,JPY,1668898800,withdrawn","VISA_20230601.csv","transaction,merchant,currency,amount,evidence_due_by,reason","110450953,63724,JPY,12750,1668898800,duplicate","123890132,47821,USD,37906,1668812400,withdrawn"]return = ["VISA123890132,47821,379.06USD,1668812400"]

The June 2 valid JPY withdrawal cancels the June 1 JPY dispute. The June 1 USD withdrawal is earlier than the June 2 USD dispute and cannot cancel it. The surviving USD dispute keeps its original deadline, 1668812400.

Constraints

  • There are 1 through 10 files, each with at most 50 data rows.
  • Every filename has the stated network and a valid eight-digit calendar date. Every header is a permutation of the six stated field names.
  • Each (network, transaction) pair appears in at most two file blocks. At most one data row for that pair has reason exactly withdrawn. This is a file bound, not a two-row bound.
  • Here, every data row has exactly six comma-separated fields; transaction, merchant, and reason are nonempty. Fields are not quoted and contain no comma or embedded line ending.
  • Here, fields contain printable ASCII characters from U+0020 through U+007E, excluding double quote, backslash, <, >, and &. No whitespace trimming is performed.
  • Here, all strings in rows together contain at most 800 UTF-8 bytes, including filenames, headers, and delimiters. Data-row strings together contain at most 500 UTF-8 bytes. These are additional practice limits.

More Stripe Online Assessment questions

  • Split Tender Part 4 - RefundsOA · PHONE SCREEN · Seen Nov 2026
  • Split Tender Part 3 - SurchargesOA · Seen Nov 2026
  • Split Tender Part 2 - Expiration DatesOA · Seen Nov 2026
  • Split Tender Part 1 - Basic Split TenderingOA · Seen Nov 2026
  • Asynchronous Event ProcessingOA · Seen Nov 2026
  • Subscription and Usage-Based Billing CalculatorOA · Seen Nov 2026
  • Payment Partner RoutingOA · Seen Nov 2026
  • Financial Account LedgerOA · PHONE SCREEN · Seen Nov 2026
  • Maximum Game Score with Fixed Forward JumpsOA · Seen Nov 2026
  • Reliable LLM Call with Independent Retry BudgetsOA · Seen Nov 2026

Similar questions at other companies

  • Aggregate Paginated Project Run RecordsReplit · OA
  • Blood Type Inheritance: Possible Parent GenotypesAbridge · OAAbridge interview questions
  • Versioned Recipe SystemThe Trade Desk · OA
  • In-Memory Filesystem CommandsPerplexity AI · PHONE SCREEN · ONSITE INTERVIEWPerplexity AI interview questions
  • Credit Card Command ProcessorChime · PHONE SCREEN
  • Autocomplete SystemPinterest · ONSITE INTERVIEWPinterest interview questions
  • Build Sessions from Unordered Events (Part 1)Scale AI · OAScale AI interview questions
  • Decode Words with Anagram KeysCresta · OACresta interview questions
  • Parcel Event TrackingAirbnb · OAAirbnb interview questions
  • Longest String ChainVisa · OAVisa interview questions

Interview reports that mention this question

  • Stripe OA: What It Tests (2026)
  • Stripe SWE Intern Chargeback Dispute OA: 1 Experience

Stripe interview experiences

  • Stripe New Grad SWE OA and Phone Screen: 2 Experiences
  • Stripe Experienced SWE OA and Onsite Questions: 3 Experiences
  • Stripe SWE Intern Linked Merchants Team Screen: 1 Experience
  • Stripe SWE Onsite over Two Days: 1 Experience
All Stripe interview questionsSee Stripe hiring insights
Saved
class Solution {
    public String[] parseChargebacks(String[] rows) {
      // write your code here
    }
}
Checking account…