Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug Report for binary-search #4001

Open
mohanlar96 opened this issue Apr 5, 2025 · 0 comments
Open

Bug Report for binary-search #4001

mohanlar96 opened this issue Apr 5, 2025 · 0 comments

Comments

@mohanlar96
Copy link

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);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant