FastPrepFirst Bad Version
Problems/First Bad Version

First Bad Version

Qualcomm logoQualcomm● EasyFULLTIMEPHONE SCREEN

Updated Nov 2026

QuestionFunctionExamples

Problem statement

Source note: Reported in a Qualcomm phone screen. The report names a well-known problem, First Bad Version, without restating it. Our version is about 98% the same as the named problem.

A product has versions numbered from 1 through n. Once a version is bad, every later version is also bad.

You are given a boolean array isBad of length n, where isBad[i] reports whether version i + 1 is bad. At least one version is bad.

Return the number of the first bad version.

Function

firstBadVersion(isBad: boolean[]) → int

Examples

Example 1

isBad = [false,false,false,true,true]return = 4

Versions 1 through 3 are good, and version 4 is the first bad version.

Example 2

isBad = [true]return = 1

The only version is bad, so it is also the first bad version.

Example 3

isBad = [false,true,true,true]return = 2

Version 1 is good, while version 2 and every later version are bad.

More Qualcomm Phone Screen questions

  • Tree DiameterPHONE SCREEN · Seen Jul 2026

Similar questions at other companies

  • First Element Greater Than KMeta · PHONE SCREENMeta interview questions
  • Sqrt(x)LinkedIn · PHONE SCREENLinkedIn interview questions
  • Track New Values in Sorted OrderBloomberg LP · PHONE SCREENBloomberg LP interview questions
  • Price at Query TimestampsGoogle · PHONE SCREENGoogle interview questions
  • First Missing Number in a Consecutive ArrayArista Networks · OA · PHONE SCREENArista Networks interview questions
  • Messages in an Inclusive Timestamp RangeAttentive · PHONE SCREEN · ONSITE INTERVIEWAttentive interview questions
  • Lowest Common Ancestor in an Inserted BSTAmazon · PHONE SCREEN
  • Target Sum Across Two Sorted ArraysSquarepoint Capital · PHONE SCREENSquarepoint Capital interview questions
  • Leftmost Binary Search MatchByteDance · PHONE SCREENByteDance interview questions
  • Count Occurrences in a Sorted ArrayAdobe · PHONE SCREEN · ONSITE INTERVIEWAdobe interview questions
All Qualcomm interview questionsSee Qualcomm hiring insights
Saved
class Solution {
    public int firstBadVersion(boolean[] isBad) {
        // write your code here
    }
}
Checking account…