I'm wondering if it's possible to perform a Binary Search in O(log n) on a JavaScript Array to find a single duplicate element.
// Example
// Input: var arr = [1, 3, 4, 4, 6, 9, 11, 12, 14]
// Output: 4
I know how to solve this in linear time, but I've been trying to write a solution in O(log n) except I'm unsure of how to proceed in terms of reducing the chunk of the array to search on each iteration. Any advice?