You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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);
The text was updated successfully, but these errors were encountered:
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);
The text was updated successfully, but these errors were encountered: