FastPrepConfusing Bib Numbers
Problems/Confusing Bib Numbers

Confusing Bib Numbers

Verily logoVerily● EasyFULLTIMEONSITE INTERVIEW

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: Reported in a Verily onsite coding round, written by hand without AI tools. The task: from a list of race bib numbers, find the ones that a reader could take for another bib number when the bib is seen upside down. The report adds that a number whose upside-down form would begin with zero does not count, since bibs are not written that way.

The report does not list which digits can be read upside down and gives no limits. Here, 0, 1 and 8 stay the same, 6 and 9 swap, the other digits cannot be read, a number that reads the same upside down is not confusing, the answer keeps the input order, and the list holds up to 1000 distinct values up to 10^9.

Our version is about 90% the same as the reported question.

Runners in a race wear bib numbers, and a bib can be read upside down by mistake. Turning a number upside down rotates it by 180 degrees: the digits are read in reverse order and each digit is turned over. 0, 1 and 8 stay the same, 6 becomes 9, and 9 becomes 6. The digits 2, 3, 4, 5 and 7 cannot be read upside down.

A bib number is confusing when its upside-down reading is a valid bib number that is different from the original. The reading is valid only when every digit can be read upside down and the reading does not start with 0, because bib numbers are never written with a leading zero.

Given the array bibs of distinct bib numbers, return the confusing ones in the order they appear in bibs. Return an empty array if none of them is confusing.

Function

confusingBibs(bibs: int[]) → int[]

Examples

Example 1

bibs = [666,10,69,16,25]return = [666,16]
  • 666 reads as 999 upside down, a different valid number, so it is confusing.
  • 10 would read as 01, which starts with 0 and is not a valid bib.
  • 69 reads as 69 again, so it is not confusing.
  • 16 reads as 91, so it is confusing.
  • 25 contains 2 and 5, which are unreadable upside down.

Example 2

bibs = [1,2,3,4,5,6,7,8,9,10]return = [6,9]
  • Among one-digit bibs, only 6 and 9 turn into a different digit.
  • 1 and 8 stay the same, and 10 would start with 0, so the answer is [6, 9].

Example 3

bibs = [88,818,100,806]return = [806]
  • 88 and 818 read the same upside down.
  • 100 would read as 001, which starts with 0.
  • 806 reads as 908: the digits reverse to 6, 0, 8 and the 6 becomes a 9. The answer is [806].

Constraints

  • 1 <= bibs.length <= 1000
  • 1 <= bibs[i] <= 1000000000
  • All values in bibs are distinct.

More Verily Onsite Interview questions

  • Christmas Tree with N TiersONSITE INTERVIEW · Seen Nov 2026
  • Package Install OrderONSITE INTERVIEW · Seen Nov 2026

Similar questions at other companies

  • Plus OneDruva · ONSITE INTERVIEW
  • Rotate a Flat Image ClockwiseGoogle · ONSITE INTERVIEWGoogle interview questions
  • Matrix MultiplicationeBay · ONSITE INTERVIEWeBay interview questions
  • Maximum Product of Three IntegersPelatro · ONSITE INTERVIEW
  • Exact-Sixty Dice Game ValueJane Street · ONSITE INTERVIEWJane Street interview questions
  • Find the Missing Number from 1 to nHyperVerge · ONSITE INTERVIEW
  • Alternating Index Square SumAccenture · ONSITE INTERVIEWAccenture interview questions
  • Moving Cost by Volume and CategoryWayfair · ONSITE INTERVIEWWayfair interview questions
  • Add One to a Number Represented as DigitsOracle · ONSITE INTERVIEWOracle interview questions
  • Streaming Entropy, Part 1: Batch EntropyOpenAI · PHONE SCREEN · ONSITE INTERVIEWOpenAI interview questions

Interview reports that mention this question

  • Verily SWE Onsite Interview Questions: 1 Experience
See Verily hiring insights
Saved
class Solution {
    public int[] confusingBibs(int[] bibs) {
        // Write your code here.
    }
}
Checking account…