Technical Coding Problems


Binary Search

This problem involves searching for a given value in a sorted array of integers. If the value is found, the index of the target value is returned; if not, -1 is returned.

Problem

Given a sorted array of integers and a target value, return the index of the target value if found, or -1 if not found.
Example input: [1, 3, 5, 7, 9], 5
Example output: 2

Solution

by AskAI
Test

A.I. Evaluation of the Solution

The candidate's solution does not demonstrate a level of completeness and does not solve the problem. The general approach is not clear.

Evaluated at: 2022-10-20 19:39:28

Community solutions:

Check these solutions from our community and artificial intelligence:
The candidate's solution is correct and demonstrates a level of completeness. The candidate has correctly identified the problem and has provided a solution that solves the problem. The candidate's approach is general and uses a binary search algorithm, which is the optimal solution for this problem.