Back to Month
MEDIUM 23 Jul 2026 View on LeetCode

3513. Number of Unique XOR Triplets I

</> Solution

class Solution {
    public int uniqueXorTriplets(int[] nums) {
        int n = nums.length;
        if (n == 1) return 1;
        if (n == 2) return 2;
        int ans = 1;
        while (ans <= n) {
            ans <<= 1;
        }
        return ans;
    }
}

TIME COMPLEXITY

O(log n)

SPACE COMPLEXITY

O(1)

TOPICS

Bit Manipulation Math