First Element Equals its Index
Let's check another problem with a sorted input array. Difficulty Level: Easy
We'll cover the following...
Problem statement
Suppose we are given a sorted array of distinct integers, nums
, which are sorted in ascending order. We will return the smallest index i
, which satisfies nums[i] == i
. If no such i
exists, we will return -1
.
Constraints: