← Questions
Fill a BIN range with card brand intervals
0
I was asked this
No reports yet. Sign in to say where you were asked it.
A six-digit BIN covers every 16-digit card number that starts with it; the other ten digits run from 0000000000 to 9999999999. You get a list of inclusive suffix intervals, each labelled with a card brand. To hide exactly where each brand's range starts and ends, stretch the intervals until together they cover the whole BIN range, and return them as full 16-digit numbers sorted by start.
- The intervals are contiguous: extend the first down to the start of the range and the last up to its end.
- There may be gaps between intervals: give each gap to the interval below it.
- Some intervals sit inside others: leave the nested ones unchanged and stretch only the outer ones.
- Merge neighbouring intervals of the same brand into one.
No official answer yet. Write yours on the right and run it.
Nothing published yet.
Sign in to submit your code; every attempt is kept here.
Write and test your solution herePython in your browser, the question's tests level by level, every submission kept for you.Sign in to start coding
