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

Commit5a3795b

Browse files
authored
Create Largest Combination With Bitwise AND Greater Than Zero.java
1 parent1c1f3cf commit5a3795b

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
classSolution {
2+
publicintlargestCombination(int[]candidates) {
3+
int[]bitCount =newint[24];
4+
for (inti =0;i <24;i++) {
5+
for (intcandidate :candidates) {
6+
if ((candidate & (1 <<i)) !=0) {
7+
bitCount[i]++;
8+
}
9+
}
10+
}
11+
intresult =0;
12+
for (intcount :bitCount) {
13+
result =Math.max(count,result);
14+
}
15+
returnresult;
16+
}
17+
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp