lets say i have an array A in non-descending order like this
A = [0, 1, 1, 1, 1, 1, 1, 2, 2, 2, 3, 4, 4, 4, 4, 4, 5, 6, 7, 8, 9, 10, 11, 12, 500, 600]
My question is: how to find the first occurence (index) of an element equal or greather (if 4 is not present) than 4?
O(n) solution is easy, i would like to have something faster. Probably binary search, but have no idea how to modify it.