Skip to content

Conversation

@aadil42
Copy link
Contributor

@aadil42 aadil42 commented Jun 26, 2023

Solved sqrtx in JS.

File(s) Added: 0069-sqrtx.js
Language(s) Used: JavaScript
Submission URL: https://leetcode.com/problems/sqrtx/submissions/980077283/

Solved sqrtx in JS.
let right = x;

while(left <= right) {
const mid = left + Math.floor((right - left)/2);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion: Use Bitwise operator for shorter syntax

const mid = ((left + right) >> 1);

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done.

Using the Bitwise operator to get the middle value.
@aakhtar3 aakhtar3 merged commit 15a8484 into neetcode-gh:main Jul 11, 2023
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

Successfully merging this pull request may close these issues.

2 participants