Card Range Obfuscation Part1 (ML Eng :)
Problem statement
A six-digit bank identification number (BIN) identifies every 16-digit card number that begins with that BIN. The remaining ten digits form a suffix from 0000000000 through 9999999999.
You are given N card intervals in info. Each row has the form [start, end, brand], where start and end are ten-digit suffixes and both endpoints are inclusive.
In Part 1, the intervals do not overlap and, after sorting by start, they form one continuous covered block. Therefore, uncovered values may exist only before the first interval or after the last interval; there are no gaps between consecutive intervals.
Return the intervals sorted by start. Prefix every suffix with the BIN to form a 16-digit card number, extend the first interval's start to the beginning of the BIN range, and extend the last interval's end to the end of the BIN range. Keep every brand and every other endpoint unchanged.
Function
cardRangeObfuscation1(BIN: int, N: int, info: String[][]) → String[][]Examples
Example 1
BIN = 424242N = 1info = [["5000000000", "6555555555", "VISA"]]return = [["4242420000000000", "4242429999999999", "VISA"]]
Example 1: the VISA interval was extended on the lower and higher ends to cover the BIN range.
Note - I double checked the input & output numbers while uploading, but since there are so many digits, I might count them wrong. If you notice anything wrong, pls feel free to lmk. I am more than happy to modify accordingly. Many thanks in advance! You da best!!
Example 2
BIN = 424242N = 2info = [["4000000000", "8999999999", "MASTERCARD"], ["1000000000", "3999999999", "VISA"]]return = [["4242420000000000", "4242423999999999", "VISA"], ["4242424000000000", "4242429999999999", "MASTERCARD"]]Example 2: the VISA interval was extended on the lower end and the Mastercard interval was extended on the higher end.
Note - I double checked the input & output numbers while uploading, but since there are so many digits, I might count them wrong. If you notice anything wrong, pls feel free to lmk. I am more than happy to modify accordingly. Many thanks in advance! You da best!!
Constraints
BINcontains exactly six decimal digits.1 <= NandN == info.length.- Every row of
infois[start, end, brand]. startandendcontain exactly ten decimal digits, andstart <= end.brandis a non-empty alphanumeric string.- The intervals are non-overlapping. After sorting by
start, each interval begins exactly one suffix after the previous interval ends.