I received this problem at Amazon for an SDE internship position. We spent about half an hour on this problem.
You are given a sorted array and two different numbers,
nandm. There may be duplicates in the array.
You have to answer the number of elements that are greater thannand less thanm.