FastPrepMinimum Unique Card Suffix Length
Problems/Minimum Unique Card Suffix Length

Minimum Unique Card Suffix Length

Bloomberg LP logoBloomberg LP● MediumNEW GRADONSITE INTERVIEW

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: The Bloomberg new-grad second virtual-onsite report asks for the fewest trailing digits needed to tell every card number apart. Its collision example ends in 1234, 1224 and 1235. The author confirms testing modulo 10, 100 and so on with a HashSet, and a reply suggests a trie of reversed digits. We only added that the numbers are all different and that the numbers fit common integer types. Our version is about 95% the same as the reported question.

Each distinct nonnegative integer in cardNumbers is a bank-card number. Return the smallest positive integer k such that the last k decimal digits of every card number are unique across the array.

The last k digits of a number are its remainder modulo 10^k. If a number has fewer than k digits, its suffix value is the entire number. Because all card numbers are distinct and fit in at most 16 decimal digits, a valid k always exists.

Function

minimumUniqueSuffixLength(cardNumbers: long[]) → int

Examples

Example 1

cardNumbers = [1111111111111234,2222222222221224,3333333333331235]return = 2

One digit gives 4, 4, 5, so the first two cards collide. Two digits give 34, 24, 35, which are all unique.

Example 2

cardNumbers = [10,20,30]return = 2

All one-digit suffixes are 0. The two-digit suffixes are 10, 20, 30.

Example 3

cardNumbers = [101,202,303]return = 1

The one-digit suffixes 1, 2, 3 are already distinct.

Constraints

  • 1 <= cardNumbers.length <= 100000.
  • 0 <= cardNumbers[i] <= 9000000000000000.
  • All values in cardNumbers are distinct.

More Bloomberg LP Onsite Interview questions

  • Collatz Conjecture with Shared MemoizationPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Word SearchOA · PHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • N-ary Index-Path Encoder and DecoderPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Top K Frequent WordsONSITE INTERVIEW · Seen Nov 2026
  • Trapping Rain WaterPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Design Browser HistoryPHONE SCREEN · ONSITE INTERVIEW · Seen Oct 2026
  • Mutable Stock Price Top KPHONE SCREEN · ONSITE INTERVIEW · Seen Oct 2026
  • Add Two Numbers IIPHONE SCREEN · ONSITE INTERVIEW · Seen Oct 2026
  • Decode StringPHONE SCREEN · ONSITE INTERVIEW · Seen Oct 2026
  • Minimum Replacements to Make Two Strings AnagramsPHONE SCREEN · ONSITE INTERVIEW · Seen Sep 2026

Similar questions at other companies

  • Group-Relative Policy AdvantagesAmazon · ONSITE INTERVIEW
  • Product Total With the Cheapest PromotionInstacart · ONSITE INTERVIEWInstacart interview questions
  • Equation Tuple CombinationZoox · ONSITE INTERVIEW
  • Unique Near-Equal Target-Sum PairsFivetran · ONSITE INTERVIEWFivetran interview questions
  • Count Pairs Divisible by KApple · ONSITE INTERVIEWApple interview questions
  • Digit-Reversed Pairs in an ArrayExpedia · ONSITE INTERVIEWExpedia interview questions
  • Max Points on a LineLinkedIn · ONSITE INTERVIEWLinkedIn interview questions
  • Majority ElementMicrosoft · ONSITE INTERVIEWMicrosoft interview questions
  • Count Index Pairs with Equal Value OffsetGoogle · ONSITE INTERVIEWGoogle interview questions
  • Net Position Calculation from API SnapshotsHeadlands Technologies · ONSITE INTERVIEWHeadlands Technologies interview questions

Bloomberg LP interview experiences

  • Bloomberg AI-Assisted Coding Round, All Levels: 14 Experiences
  • Bloomberg SWE Intern Interview Questions: 68 Questions
  • Bloomberg Interview Questions, Level Not Reported: 65 Questions
  • Bloomberg Experienced Design & More: 126 Questions (Part 2 of 2)
  • Bloomberg Experienced SWE Interviews: 167 Questions (Part 1 of 2)
  • Bloomberg New Grad Coding Questions: 121 Questions (Part 2 of 2)
All Bloomberg LP interview questionsSee Bloomberg LP hiring insights
Saved
class Solution {
    public int minimumUniqueSuffixLength(long[] cardNumbers) {
        // Write your code here.
    }

}
Checking account…