Skip to content

Commit

Permalink
More tweaks.
Browse files Browse the repository at this point in the history
  • Loading branch information
crazybob committed Nov 14, 2011
1 parent 6b2c0ff commit 31fd76c
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,11 @@ You find yourself trapped by a crippling but otherwise healthy fear of accidenta

Think you've got what it takes? Write a command line program that reads ASCII text from standard input, masks sequences of digits that look like credit card numbers, and writes the filtered text to standard output. For the purposes of this challenge, a credit card number:

- Consists of digits, spaces (`' '`) and hyphens (`'-'`).
- Has between 14 and 16 digits, inclusive.
- Passes the Luhn check.
- Can contain any number and combination of `' '` or `'-'` characters.

If a sequence of digits looks like a credit card number, replace each digit with an `'X'`. Any characters, including digits, may flank a credit card number. *Beware:* A valid 16-digit number can contain a valid 14 or 15-digit number. Your program must mask every digit.

This isn't a contest, but an innovative solution could score you interviews at Square. I'm primarily interested to see how different programming languages stack up with regard to readability and performance.
If a sequence of digits looks like a credit card number, replace each digit with an `'X'`. Any characters, including digits, may flank a credit card number. *Beware.* Potential credit card numbers can overlap. A valid 16-digit number can even contain a valid 14 or 15-digit number. Your program must mask every digit.

I already wrote a test suite, so you can jump straight to the fun part: writing the algorithm. To participate:

Expand All @@ -68,6 +66,8 @@ The first time you execute `run.sh`, you'll see a test failure:

Modify `mask.sh` and make the tests pass. [Line feeds](http://en.wikipedia.org/wiki/Newline) delineate the test cases. If you pass a number on the command line, `run.sh` will repeat the test suite the specified number of times; this is useful for performance comparisons. The tests aren't set in stone—if you have an idea for improving the test suite, please submit a pull request.

This isn't a contest, but an innovative solution could score you interviews at Square. I'm primarily interested to see how different programming languages stack up with regard to readability and performance.

Once we have enough interesting submissions, I'll summarize the results in a followup [blog](http://corner.squareup.com/) post and open source our own Java-based implementation. In the mean time, if you enjoy working with talented people on challenging problems like this, email your résumé to <a href="mailto:luhnybin@squareup.com">luhnybin@squareup.com</a>.

Good luck!

0 comments on commit 31fd76c

Please sign in to comment.