Skip to content

Practice Triples with Bitwise AND Equal To Zero

Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.

Hard#982
LeetCode Problem

Triples with Bitwise AND Equal To Zero

Problem Statement

Count ordered triples of indices (i, j, k) in nums for which nums[i] & nums[j] & nums[k] equals 0, where & is bitwise AND. Each index may be any valid array position; repeated indices are allowed.

Source: Triples with Bitwise AND Equal To Zero on LeetCode. Use the original task for its coding environment and submissions.

Examples

# Example 1

Input
nums = [2,1,3]
Output
12

# Example 2

Input
nums = [0,0,0]
Output
27

Constraints

1 <= nums.length <= 1000
0 <= nums[i] < 2^16

Related LeetCode Problems

Practice more problems similar to Triples with Bitwise AND Equal To Zero.

Review your practice with PhantomCodeAI

After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.