Find Fixed Number
In this lesson, you will learn how to find a fixed number in a list using a binary search in Python.
We'll cover the following...
In this lesson, we will be solving the following problem:
Given an array of distinct integers sorted in ascending order, write a function that returns a fixed point in the array. If there is not a fixed point, return None
.
A fixed point in an array
A
is an indexi
such thatA[i]
is equal toi
.
The naive approach to solving this problem is pretty simple. You iterate through the list and check if each element matches ...