Is it feasible to use Binary Search in O(log n) on a JavaScript Array to identify a single duplicate element?
// Here is an example
// Input: var arr = [1, 3, 4, 4, 6, 9, 11, 12, 14]
// Output: 4
I am familiar with the linear time solution for this problem. However, I am currently experimenting with a potential O(log n) solution. My challenge lies in figuring out how to reduce the chunk of the array to be searched at each iteration. Any suggestions or guidance would be appreciated!