Company: Stripe_30oct
Difficulty: medium
Card Range Obfuscation Problem Description The first six digits of a payment card number are its bank identification number, or BIN. A BIN range covers every card number that begins with that BIN, so the BIN 424242 covers 4242420000000000 through 4242429999999999 . Written as the ten digits that follow the BIN, that range is 0000000000 through 9999999999 . A card metadata service reports which brand owns which part of a BIN range, as a list of inclusive intervals. The intervals never overlap, but they may leave gaps at the start of the range, between two intervals, or after the last one. Those gaps tell an attacker exactly which card numbers are not issued, so they have to be removed: the reported intervals must be stretched until together they cover the whole range with no gap left. A gap is absorbed by the interval on its left; the gap before the very first interval is absorbed by that first interval. Concretely, once the intervals are in order of their start value: the first interva