We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
1
// 查找最后一个小于等于给定值的元素 const biaryFindLastSmall = (sortedArr, target) => { if (sortedArr.length === 0) return -1 let low = 0 let high = sortedArr.length - 1 while (low <= high) { const mid = Math.floor((low + high) / 2) if (target < sortedArr[mid]) { high = mid - 1 } else { // Error: if (mid === sortedArr.length - 1 || sortedArr[mid + 1] >= target) return mid // Right: if (mid === sortedArr.length - 1 || sortedArr[mid + 1] > target) return mid low = mid + 1 } } return -1 }
2 binary not biary
The text was updated successfully, but these errors were encountered:
No branches or pull requests
1
2
binary not biary
The text was updated successfully, but these errors were encountered: