Stripe Coding Interview: Exchange Rate String Parser
Based on questions reported for Stripe interviews
The interviewer opens
Hi, and thanks for joining. Welcome to your interview for the software engineer role at Stripe. We'll work through a coding problem together, and I'd like you to think out loud as you code. If you need to step out or take a break, you can pause any time with the Pause button at the top right.
The problem is about turning compact exchange-rate strings into structured records, the kind of data handling that comes up a lot in payments. It's in the Problem tab on the right, so please read it through, take your time, and ask me any questions before you start.
The problem
Exchange rates arrive as one compact string.
rates: comma-separated entries, eachfrom:to:method:rate, e.g.USD:CAD:DHL:5.
Return a list of records {source, target, method, rate}, one per entry, in input order. rate is returned as a float; in the string it may be an integer or a decimal such as 1.25. Currency codes and methods are uppercase letters. An empty string has no entries and gives an empty list.
Example: "USD:CAD:DHL:5,USD:GBP:FEDX:10" → [{source: "USD", target: "CAD", method: "DHL", rate: 5.0}, {source: "USD", target: "GBP", method: "FEDX", rate: 10.0}]
Sizes: up to 1,000 entries.