OA VO support

Welcome to 2024-25 Stripe University Recruiting HackerRank Challenge – Stripe OA 真题 – OA 代写- 面试代面

Card Metadata

Card Range Obfuscation

Payment card numbers are composed of eight to nineteen digits, the leading six of which are referred to as the bank identification number (BIN). Stripe’s card metadata API exposes information about different card brands within each BIN range by returning a mapping of card intervals to brands.

However, a given BIN range may have gaps at the beginning, middle, or end of the range where no valid cards are present. This information can be used by fraudsters to test for valid credit cards with a high degree of probability. To prevent fraudsters from abusing the data gaps, we must fill in missing values by extending the returned intervals to cover the entire range.

A BIN range refers to all the 16-digit card numbers starting with a given BIN. For example, a BIN of 424242 has a range of 4242420000000000 to 4242429999999999, inclusive.

An interval is a subset of a BIN range, also inclusive.

In this problem, we’ll be taking as input a 6-digit BIN and a list of 10-digit intervals within the BIN range corresponding to brands. We’ll return a list of sorted intervals covering the entire BIN range (i.e., for a BIN of 424242, covering 4242420000000000 to 4242429999999999).

Input format

Your input will consist of one line containing a six-digit BIN, one line containing a positive integer N, and N lines containing intervals and their corresponding brands.

The format of each interval is start,end,brand, where start and end are the 10 digits following the input BIN and brand is an alphanumeric string.

Example:

777777
2
1000000000,3999999999,VISA
4000000000,5999999999,MASTERCARD

Output format

Your output will consist of one or more lines containing the resulting intervals and their corresponding brands. The output intervals should be sorted by start.

Example:

7777770000000000,7777773999999999,VISA
7777774000000000,7777779999999999,MASTERCARD

Formatting Note

For most languages, Hackerrank will provide you with a code stub and a function to implement.

Part 1

For the first set of test cases, you’ll be given a set of non-overlapping intervals with gaps on the lower end and/or higher end of the BIN range. You’re expected to extend the lowest interval to the lower boundary of the BIN range, and the highest interval to the higher boundary of the BIN range. This will be sufficient to solve the first 4 test cases.

Example 1: the VISA interval was extended on the lower and higher ends to cover the BIN range.

Input:

424242
1
5000000000,6555555555,VISA

Output:

4242420000000000,4242429999999999,VISA

Example 2: the VISA interval was extended on the lower end and the Mastercard interval was extended on the higher end.

Input:

424242
2
4000000000,8999999999,MASTERCARD
1000000000,3999999999,VISA

Output:

4242420000000000,4242429999999999,VISA

Part 2

For the second set of test cases, the set of non-overlapping intervals can also contain gaps in between known intervals. In these cases, 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.

Example 1: the VISA interval was extended on the higher end to fill the gap, up to the Mastercard interval.

Input:

424242
2
0000000000,3700000000,VISA
6100000000,9999999999,MASTERCARD

Output:

4242420000000000,4242429999999999,VISA

Part 3

For the third set of test cases, the input may contain intervals that are proper subsets of other intervals. When extending an interval to cover a gap, you should only extend the covering interval. This will be sufficient to solve the next 2 test cases.

Example 1: the first Visa interval and second CB interval are extended.

Input:

424242
4
1000000000,5000000000,VISA
2000000000,4000000000,CB
6000000000,9000000000,CB
7000000000,8000000000,VISA

Output:

4242420000000000,4242429999999999,VISA

Part 4

For the fourth set of test cases, adjacent intervals (i.e. intervals with no gaps in between) with the same brand after extending should be merged into one interval in the output. This will be sufficient to solve the next 3 test cases.

Example 1: the two adjacent VISA intervals were merged.

Input:

424242
2
0000000000,5999999999,VISA
6000000000,9999999999,VISA

Output:

4242420000000000,4242429999999999,VISA

我们长期稳定承接各大科技公司如TikTok、Google、Amazon等的OA笔试代写服务,确保满分通过。如有需求,请随时联系我们。

We consistently provide professional online assessment services for major tech companies like TikTok, Google, and Amazon, guaranteeing perfect scores. Feel free to contact us if you're interested.

Leave a Reply

Your email address will not be published. Required fields are marked *