r/OfferEngineering • u/Aoki_zhang • 1d ago
Coding Question Stripe SWE Coding Screen Problem - Makerspace Grant Disbursements
Problem Description
A makerspace reimburses members for approved supply purchases on a regular schedule. You receive a list receipts in input order, with each record written as "<receiptId>,<cents>,<day>". The integer release_interval sets the number of days between reimbursements.
Release days are the positive multiples of release_interval. Assign each receipt to the first release day strictly after the day of purchase. A receipt dated on a release day goes into the next batch.
Return one string per release day that has at least one receipt, sorted by release day in ascending numeric order. Each string uses the format "<releaseDay>,<amountInDollars>,<receiptIds>": add the amounts in cents, convert the total to dollars with exactly two decimal places and no currency symbol, and join the receipt IDs with | in their original input order. Include batches with receipts totaling zero, and return an empty list if there are no receipts.
Constraints:
0 ≤ receipts.length ≤ 1,0001 ≤ release_interval ≤ 1,0000 ≤ day ≤ 10⁶and0 ≤ cents ≤ 10⁶for every receipt.- Each receipt ID is unique, contains 1 to 30 characters, and contains neither a comma nor a vertical bar.
- All records are well-formed.
Example:
Input:
receipts = ["ink,870,0", "wire,9,3", "clamp,220,4"]
release_interval = 4
Output:
["4,8.79,ink|wire", "8,2.20,clamp"]
Explanation:
The first two receipts total 879 cents and are released on day 4. The clamp receipt is dated on day 4, so it is released on day 8.Want to practice it before interview?
You can practice it and view solution code at here.
Preparing for your next interview?
Chill Interview tracks recent interview experiences and recurring question patterns across top companies at here.