Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit07dfbff

Browse files
authored
Update 0069-sqrtx.js
Using the Bitwise operator to get the middle value.
1 parenta898b71 commit07dfbff

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

‎javascript/0069-sqrtx.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ var mySqrt = function(x) {
1111
letright=x;
1212

1313
while(left<=right){
14-
constmid=left+Math.floor((right-left)/2);
14+
constmid=(left+right)>>1;
1515
if(mid*mid<=x&&(mid+1)*(mid+1)>x)returnmid;
1616
if(mid*mid<x){
1717
left=mid+1;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp