JavaScript Coding Questions50. search element right before target with Binary Search(possible duplicate array)

# 50. search element right before target with Binary Search(possible duplicate array)

Share

easy - accepted / - tried

This is a variation of 37. implement Binary Search (unique).

Your are given a sorted ascending array of number, but **might have duplicates**, you are asked to return the **element right before first appearance** of a target number.

If not found return `undefined`

.

*note*

Please don't use `Array.prototype.indexOf()`

, it is not our goal.

37. implement Binary Search (unique) 48. search first index with Binary Search(possible duplicate array) 49. search last index with Binary Search(possible duplicate array) 51. search element right after target with Binary Search(possible duplicate array)

Related Lists

Binary Search is important for Front End