InterviewDB Question

Credit Card Number: Validate and Mask Credit Card Numbers Using Luhn's Algorithm

Question Details

Problem Implement two functions: is_valid(card_number: str) -> bool — validate using the Luhn algorithm. mask(card_number: str) -> str — replace all but the last 4 digits with *. The Luhn check: from the rightmost digit, double every second digit; if…

Full Details

🔒

Unlock full leaked content

Full insider details, leaked discussions, and candidate experiences.

Get Premium →

Topics

Coding Phone