Calculate Round-Up Savings Per Space From Card Transactions

Last updated: November 29, 2026

Quick Overview

Given a list of card transactions as (amount in cents, space id), compute how many cents each Space would collect if every purchase were rounded up to the next whole euro. Refunds, zero amounts and purchases that are already whole euros contribute nothing.

N26
Coding & Algorithms
Software Engineer
N26
November 29, 2026
Software Engineer
Phone Screen
Coding & Algorithms
Easy

0

0

0 solved


Given a list of card transactions as (amount in cents, space id), compute how many cents each Space would collect if every purchase were rounded up to the next whole euro. Refunds, zero amounts and purchases that are already whole euros contribute nothing.

N26 phone screens often open with a short problem built on a real banking feature, here the Round-Ups that sweep spare change into a Space. The interviewer checks that you handle money as integer cents, think about refunds and exact amounts without being told, and write clean code quickly.

What the Interviewer Expects
  • Represent money as integer cents, never floats
  • Use modulo to find the remainder and the round-up amount
  • Skip refunds, zero amounts and exact euro purchases explicitly
  • Aggregate per Space with a hash map in one pass
  • State O(n) time and O(s) space for s Spaces
Key Topics to Cover
hash maps
integer money arithmetic
modulo
aggregation
edge cases
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 support a 2x or 5x round-up multiplier per customer?
  • What changes if transactions arrive in different currencies but Spaces are in EUR?
  • How should a later refund of a rounded-up purchase affect the Space balance?
  • How would you make this idempotent if the same transaction event is delivered twice?
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

Input: list of (amount_cents, space_id). Output: dict of space_id -> cents saved. A purchase of 12.50 EUR (1250) rounds up to 13.00, so 50 cents go to its Space. Negative amounts are refunds and d...

High-Level Design

One pass with a dictionary. For each positive amount, compute amount % 100. If the remainder is non-zero, the round-up is 100 - remainder. Add it to that Space's total. Integer cents avoid binary ...


Submit Your Answer
Markdown supported