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

Commit 292346a

Browse files
Update Bitwise Operators.js
1 parent 164cee8 commit 292346a

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

‎Day 6/Bitwise Operators.js‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
function getMaxLessThanK(n, k) {
2+
let max_anb = 0;
3+
for (let b = n; b > 0; b--) {
4+
for (let a = b-1; a > 0; a--) {
5+
if ((a & b) < k && (a & b) > max_anb){
6+
max_anb = (a&b);
7+
}
8+
}
9+
}
10+
return max_anb;
11+
}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /