Skip to content

Commit

Permalink
Tweaked last paragraph.
Browse files Browse the repository at this point in the history
  • Loading branch information
crazybob committed Nov 14, 2011
1 parent 454ed04 commit 6b2c0ff
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 2 deletions.
6 changes: 4 additions & 2 deletions README.md
Expand Up @@ -3,7 +3,7 @@ Coding Challenge: The Luhny Bin

> "To err is human; to forgive, divine." -Alexander Pope
Computers break. Mistakes happen. At Square, we accept that human error is inevitable. We anticipate potential slip-ups and implement safety measures to mitigate—and oftentimes completely eliminate—any repercussions.
Mistakes happen. At Square, we accept that human error is inevitable. We anticipate potential slip-ups and implement safety measures to mitigate—and oftentimes completely eliminate—any repercussions.

For example, Square's Luhn filter monitors logs and masks anything that looks like a credit card number. If a number like "4111 1111 1111 1111" were accidentally logged as part of an error message, our filter would replace it with "XXXX XXXX XXXX XXXX" and page an on call engineer.

Expand Down Expand Up @@ -68,4 +68,6 @@ 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.

Once we have enough interesting submissions, I'll post a followup to [our blog](http://corner.squareup.com/) summarizing the results. I'll open source our own Java-based solution after everyone has had time to give the problem a shot. Good luck!
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!
18 changes: 18 additions & 0 deletions tests/src/main/java/com/squareup/luhnybin/LuhnyBinTests.java
Expand Up @@ -60,6 +60,24 @@ public class LuhnyBinTests extends TestSuite {
.send(nestedNumber())
.expect(mask(16));

// 1111111111111abc

// 15:
// 111111111111abc
// 121212121212aBc
// (18 + a + B + c) % 10 = 0

// 16:
// 1111111111111abc
// 2121212121212aBc
// (20 + a + B + c) % 10 = 0

// (18 + a + B + c) % 10 = (20 + a + B + c) % 10

// a: 0-9
// B: 0-9
// c: 0-9

test("16-digit # flanked by non-matching digits")
.send("9875610591081018250321")
.expect("987XXXXXXXXXXXXXXXX321");
Expand Down

0 comments on commit 6b2c0ff

Please sign in to comment.