Your team's deploy dashboard keeps every build number it has shipped in builds, sorted from smallest to largest, with no repeats.
Write findBuild(builds, target) that returns the index of target in builds, or -1 if that build was never shipped.
The dashboard can hold hundreds of thousands of builds, so check as few of them as you can: aim for O(log n).
Input: builds = [101,104,107,115,120,133], target = 115 Output: 3
115 sits at index 3.
Input: builds = [101,104,107,115,120,133], target = 110 Output: -1
110 was never shipped.
0 <= builds.length <= 100000builds is sorted ascending and has no duplicates.-10^9 <= builds[i], target <= 10^9Run tries your code on the examples. Submit runs every test, including hidden edge cases, and solves the problem when they all pass.
Ctrl + Enter runs, Ctrl + Shift + Enter submits (⌘ on a Mac).
I'm here to help with #150 Locate a Build Number. I give hints, never the solution, so you get to solve it yourself. Ask for a hint, select code to ask about it, or press Ask Tuto why on a failing test.
Your first 3 answers need no account. for free to keep asking.