Parse CSV and format transactions
KikoffSoftware Engineer · Technical ScreenLast updated
This question evaluates a candidate's ability to parse and format structured transactional data, emphasizing CSV parsing, trimming whitespace, numeric formatting to two decimal places, and preserving input row order.
Given a CSV file containing many transactional records with columns Merchant, Amount, Date (YYYY-MM-DD), and Status, write a script to parse the file and print, for each transaction, the following two-line block exactly in the given order:
| {Merchant} ${Amount with two decimals} | | {Date} {Status} |
Example for one row:
| Merchant $10.04 | | 2020-01-01 pending |
Requirements:
- Preserve the input row order.
- Format Amount as a dollar value with two decimals (e.g., $10. 04).
- Trim surrounding whitespace in fields before formatting.
- Output one block per transaction with the same delimiter lines and spacing pattern.
Solution walkthrough is for members
Get the full walkthrough with reference code and complexity analysis, plus Kitty Coach at 300 messages a day. Hints, the code runner and community answers stay free.