Pergunta de entrevista da empresa PayPal

Binary search(iteration and recursive version). Extends: How do you solve if it is duplicate(find the first one with O(logN))