medium Algorithms 25 points

Binary Search Implementation

Implement a binary search algorithm that takes a sorted array and a target value, and returns the index of the target if found, or -1 if not found.

Problem Description

Implement a binary search algorithm that takes a sorted array and a target value, and returns the index of the target if found, or -1 if not found.

Examples

Example

Input: [1,3,5,7,9], 5

Output: 2

Challenge Info

25 Points

Reward

medium

Difficulty

No limit

Time Limit

Submission Stats

Total Submissions 0
Accepted 28
Success Rate 0%