Level: Senior-Level
Round: Phone Screen · Type: Coding · Difficulty: 7/10 · Duration: 60 min · Interviewer: Unfriendly
Topics: Object-Oriented Programming, Data Structures, Algorithms, Credit Card Validation, Luhn Algorithm
Location: San Francisco Bay Area
Interview date: 2026-01-15
I had to implement a credit card provider simulation, handling commands like adding accounts, processing charges and credits, and displaying account summaries. The card numbers needed validation, including a bonus to implement the Luhn 10 algorithm.
I was tasked with writing software for a credit card provider. I needed to implement a program that could add new credit card accounts, process charges and credits against them, and display summary information. I was given a list of commands:
Add <card_holder> <card_number> <limit>: This command creates a new credit card for the given card holder, card number, and limit. New cards start with a 0 balance.Charge <card_holder> <amount>: This command increases the balance of the card associated with the provided name by the amount specified. Charges that would raise the balance over the limit are ignored.Credit <card_holder> <amount>: This command decreases the balance of the card associated with the provided name by the amount specified. Credits that would drop the balance below $0 will create a negative balance.Credit card numbers required basic validation: they should be composed of digits [0-9] and be between 12 and 16 characters long.
As a bonus, I was asked to implement the Luhn 10 algorithm.
The final output should return the card holder names with the balance of the card associated with the provided name, displayed in lexicographical order.
Similar to this problem: https://leetcode.com/discuss/post/1912135/chimebank-phone-interview-by-anonymous_u-veu1/