Limited Time Offer:Up to 20% off Hello Interview Premium
Up to 20% off Hello Interview Premium 🎉
Hello Interview
Your Dashboard
System Design
Code
Low Level Design
Behavioral
AI Coding
New
ML System Design
Salary Negotiation
Interview Guides
Blog
System Design
Low Level Design
AI Coding
Behavioral
New
Interview Questions
Success Stories
System Design
Low-Level Design
New
Ask The Community
Discord
Mock Interviews
1:1 Mentorship
Refer a Friend
Pricing
Sign in / Sign up
Search
⌘K
Pricing

Tutor

Credit Card Validation and Discount Application

Implement a credit card payment system that validates a credit card number using the Luhn (Mod 10) algorithm and applies the appropriate discount to a bill amount based on the card type (Visa, Mastercard, American Express, or Discover).

Asked at:

M

MiQ Digital


Question Timeline

See when this question was last asked and where, including any notes left by other candidates.

Company
​
Level
All Regions
Region

Early May, 2026

M

MiQ Digital

Senior

Credit Card Discount Question: Implement a portion of a credit card payment system that takes the Bill amount, Credit card number as the input and returns the discounted bill amount if the credit card is valid, else an error if the credit card is invalid Procedure to validate a credit card number Luhn check or the Mod 10 check, which can be described as follows (for illustration, consider the card number 4388576018402626): Step 1. Double every second digit from right to left. If doubling of a digit results in a two-digit number, add up the two digits to get a single-digit number (like for 12:1+2, 18=1+8). Step 2. Now add all single-digit numbers from Step 1. 4 + 4 + 8 + 2 + 3 + 1 + 7 + 8 = 37 Step 3. Add all digits in the odd places from right to left in the card number. 6 + 6 + 0 + 8 + 0 + 7 + 8 + 3 = 38 Step 4. Sum the results from Step 2 and Step 3. 37 + 38 = 75 Step 5. If the result from Step 4 is divisible by 10, the card number is valid; otherwise, it is invalid. Bill Discount Details Discount is based on the starting digit of the credit card and the corresponding discount values can be seen below 4 for Visa cards - Discount 10% 5 for Master cards - Discount 15% 37 for American Express cards - Discount 5% 6 for Discover cards - No Discount What you need to provide We expect you to provide a working solution to the problem, at least for the scenarios provided; it may just consist of hard coded data in a set of unit tests. Please note that input/output or persistence are NOT required. Concentrate your efforts on coming up with a solution that is Simple Modular Extensible Testable Examples Input: {“Bill Amount”: 10000, “CC_Card”: “379354508162306”} Output: {“CC_Status”:”Valid”, “Bill Amount”: 9050} Input: {“Bill Amount”: 10000, “CC_Card”: “4388576018402626”} Output: {“CC_Status”:”Invalid”, “Bill Amount”:10000}

Your account is free and you can post anonymously if you choose.

Hello Interview Premium

Recent interview questions
System Design Guided Practice
Exclusive content
Learn More
Questions
Meta SWE Interview QuestionsAmazon SWE Interview QuestionsGoogle SWE Interview QuestionsOpenAI SWE Interview QuestionsEngineering Manager (EM) Interview Questions
Learn
Learn System DesignLearn DSALearn BehavioralLearn ML System DesignLearn Low Level DesignGuided Practice
Links
FAQPricingGift PremiumHello Interview Premium
Legal
Terms and ConditionsPrivacy PolicySecurity
Contact
About UsProduct Support

7511 Greenwood Ave North Unit #4238 Seattle WA 98103


© 2026 Optick Labs Inc. All rights reserved.