Skip to content

Bug Report for binary-search #4001

Closed
Closed
@mohanlar96

Description

@mohanlar96

Bug Report for https://neetcode.io/problems/binary-search

Please describe the bug below and include any steps to reproduce the bug or screenshots if possible.

class Solution {
/**
* @param {number[]} nums
* @param {number} target
* @return {number}
*/
search(nums, target) {
// There is no built in function for JS.
return nums.indexOf(target);
}
}

Correction => There is a built-in function for JS.

Additional information => we can also calculate mid by this formula , which I felt more easier

let mid = Math.floor((start + end)/2);

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions