Back to July Back to Year 2026
MEDIUM 23 Jul 2026 View on LeetCode

3513. Number of Unique XOR Triplets I

</> Solution

/**
 * Problem: LeetCode 3513 - Number of Unique XOR Triplets I
 * Difficulty: Medium
 * Language: Java
 * Author: CodeByTushu
 */
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

Array Bit Manipulation Math