Skip to content

Commit

Permalink
Time: 114 ms (82.44%) | Memory: 54.6 MB (53.17%) - LeetSync
Browse files Browse the repository at this point in the history
  • Loading branch information
ShatilKhan committed Feb 21, 2024
1 parent 2df92cf commit 69abb63
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions 201-bitwise-and-of-numbers-range/bitwise-and-of-numbers-range.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/**
* @param {number} left
* @param {number} right
* @return {number}
*/
var rangeBitwiseAnd = function(left, right) {
let cnt = 0;
while (left !== right) {
left >>= 1;
right >>= 1;
cnt++;
}
return left << cnt;
};

0 comments on commit 69abb63

Please sign in to comment.