Skip to content

Commit afcec06

Browse files
committed
Runtime: 261 ms (Top 34.83%) | Memory: 49.1 MB (Top 40.45%)
1 parent 8a28b58 commit afcec06

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed
Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,21 @@
1+
// Runtime: 261 ms (Top 34.83%) | Memory: 49.1 MB (Top 40.45%)
12
var rangeBitwiseAnd = function(left, right) {
23
const a = left.toString(2);
34
const b = right.toString(2);
4-
5+
56
if (a.length !== b.length) {
67
return 0;
78
}
89

910
let match = 0;
10-
11+
1112
for (let i = 0; i < a.length; i++) {
1213
if (a[i] !== b[i]) {
1314
break;
1415
}
15-
16+
1617
match++;
1718
}
1819

1920
return parseInt(b.substring(0, match).padEnd(b.length, '0'), 2);
20-
};
21+
};

0 commit comments

Comments
 (0)