FastPrepCard Range Obfuscation Part 2 (ML Eng :)

Card Range Obfuscation Part 2 (ML Eng :)

Stripe logoStripe● MediumFULLTIMEOA
Learn

Problem statement

🐝 Hi there! The description you are currently reading is just 2nd part of the problem set. It is highly recommended to read ALL THE PARTS before coding as parts may build on top of each other 🐳

Part 2

For the second set of testcases, the set of non-overlapping intervals can also contain gaps in between known intervals. In these casds, the interval on the lower end of the gap will be extended to fill the gap. This will be sufficient to solve the next 4 test cases.

Function

cardRangeObfuscation2(BIN: int, N: int, info: String[][]) β†’ String[][]

Examples

Example 1

BIN = 424242N = 2info = [["0000000000", "3700000000", "VISA"], ["6100000000", "9999999999", "MASTERCARD"]]return = [["4242420000000000", "4242426099999999", "VISA"], ["4242426100000000", "4242429999999999", "MASTERCARD"]]

VISA already begins at suffix 0000000000. Extend its upper boundary through the middle gap to 6099999999; MASTERCARD already reaches 9999999999. Prefix every boundary with BIN 424242.

Example 2

BIN = 424242N = 3info = [["0100000000", "1299999999", "VISA"], ["1900000000", "9999999999", "AMEX"], ["1500000000", "1699999999", "MASTERCARD"]]return = [["4242420000000000", "4242421499999999", "VISA"], ["4242421500000000", "4242421899999999", "MASTERCARD"], ["4242421900000000", "4242429999999999", "AMEX"]]

Sort the intervals by suffix start. Extend VISA down to 0000000000 and through 1499999999; extend MASTERCARD through 1899999999; AMEX already reaches 9999999999. Prefix every boundary with BIN 424242.

Constraints

  • 🫢

More Stripe problems

See Stripe hiring insights
public String[][] cardRangeObfuscation2(int BIN, int N, String[][] info) {
  // write your code here
}
BIN424242
N2
info[["0000000000", "3700000000", "VISA"], ["6100000000", "9999999999", "MASTERCARD"]]
expected[["4242420000000000", "4242426099999999", "VISA"], ["4242426100000000", "4242429999999999", "MASTERCARD"]]
Checking account…