Wednesday, July 18, 2012

Array and positions

Given an array of n distinct integers sorted in ascending order, write a function that returns true is there is an index i such that arr[i] is equal to i

1 comment:

  1. return a[0] == 0

    // Checking only the first item is good enough.