2275. Largest Combination With Bitwise AND Greater Than Zero (&1, >>= 1 )
T: O(n*32)
classSolution {publicintlargestCombination(int[] candidates) {int[] bitCount =newint[32];for (int num : candidates) {int i =0;while (num >0) {int isOne = num &1; num >>=1; bitCount[i++] += isOne; } }int result =0;for (int c : bitCount) { result =Math.max(result, c); }return result; }}/**421 001101011how to make result > 0, the larget number of the bit is 1 at the same position! T: O(n*32) 10000 100011000111 111110 1100 11000 1110 */