Category: Coding Interview

Find the first occurrence of a number using binary search

In this post we will take a look at a small modification to binary search. Instead of looking for the location of a specific target we will now try to find the first occurrence of that target. For example if we have an array like below [crayon-5e246188841d5511621365/] and our target is 2 then out our

Binary Search

Welcome to the binary search series! In this series of post we will focus on implementing binary search for coding interviews and some of the common pitfalls that come along. We will start with the most basic implementation of binary search first. Before we start coding a solution we want to make that we are