Card Range Obfuscation Part 3 (ML Eng :)
Problem statement
Part 3 — contained intervals
This part keeps the Part 1 and Part 2 rules: each row contains an inclusive 10-digit suffix interval inside the supplied six-digit BIN, outer intervals are sorted by start, the first outer interval is extended to 0000000000, every gap between outer intervals is assigned to the interval on its lower side, and the last outer interval is extended to 9999999999.
In Part 3, an input interval may also be a proper subset of another interval. A contained interval is preserved exactly. It is not extended into a gap. Only intervals that are not contained by another input interval—the covering intervals—participate in filling the beginning, middle, and end gaps.
Return every adjusted covering interval together with every unchanged contained interval. Prefix each suffix boundary with the BIN and sort the result by suffix start. The available source diagram shows the contained ranges remaining nested while the covering VISA and CB ranges expand across the missing regions.
Function
cardRangeObfuscation3(BIN: int, N: int, info: String[][]) → String[][]Examples
Example 1
BIN = 424242N = 4info = [["1000000000", "3999999999", "VISA"], ["2000000000", "2999999999", "CB"], ["6000000000", "8999999999", "CB"], ["7000000000", "7999999999", "VISA"]]return = [["4242420000000000", "4242425999999999", "VISA"], ["4242422000000000", "4242422999999999", "CB"], ["4242426000000000", "4242429999999999", "CB"], ["4242427000000000", "4242427999999999", "VISA"]]The VISA interval and the later CB interval are the two covering intervals. VISA expands left to suffix 0000000000 and right through the gap ending at 5999999999; CB expands right to 9999999999. The nested CB and VISA intervals retain their original boundaries.
Constraints
BINhas exactly six decimal digits andN == info.length > 0.- Each row is
[startSuffix, endSuffix, brand]; both suffixes contain exactly ten decimal digits andstartSuffix <= endSuffix. - Any overlapping pair is related by proper containment; crossing overlaps are not present.
- Only intervals not contained by another input interval fill gaps. Proper subsets keep their original boundaries.
- Result rows are inclusive full 16-digit card-number intervals sorted by suffix start.