square/luhnybin — pull request #1 by bdurette (2011-11-15 06:25:45+00:00)
Title: Java solution to the Luhny Bin

Here's my Java solution to the Luhny Bin problem. It memoizes the "Luhny Sums" (odd and even) of potential credit card numbers at each character offset in the input stream. It uses the lookup table to compute the check values for 14 through 16 digit numbers ending at any given character and masks accordingly.

Some potential improvements:

1. Store information in the mask step to eliminate the need to remask overlapping regions.
2. Save memory by not storing the entire lookup table in memory. Each time a non-credit-card character is encountered, the table can be cleared. This is only necessary if long inputs are expected.

All in all, a fun problem. Thanks!