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:
Store information in the mask step to eliminate the need to remask overlapping regions.
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.
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:
All in all, a fun problem. Thanks!