Binary Search: Given a Sorted Array of Integers, Write a Function that...

This problem deals with implementing a binary search algorithm to find the index of a given target value in a sorted array. If the target is not found, the function should return -1.

Problem

Given a sorted array of integers, write a function that returns the index of a given target value. If the target is not found, return -1.
Example input:
[-5, 1, 3, 6, 10], target = 3
Example output:
2

Solution

This solution is in C#. Our A.I. can create solutions in multiple languages.
by kayakane
using System;

namespace InterviewPreperationGuide.Core.CrackingTheCodingInterview.c17q10 {
    public class Solution {
        public void Init () {
            Console.WriteLine ();
        }
    }
}

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-12-08 12:15:34