Array Bit Manipulation Math 3513. Number of Unique XOR Triplets I ¶ Time: $O(\log n)$ Space: $O(1)$ C++JavaPython 1 2 3 4 5 6 7 8 9class Solution { public: int uniqueXorTriplets(vector<int>& nums) { const int n = nums.size(); if (n < 3) return n; return 1 << (static_cast<int>(log2(n)) + 1); } }; 1 2 3 4 5 6 7 8 9class Solution { public int uniqueXorTriplets(int[] nums) { final int n = nums.length; if (n < 3) return n; final int x = (int) (Math.log(n) / Math.log(2)); return 1 << (x + 1); } } 1 2 3 4 5 6class Solution: def uniqueXorTriplets(self, nums: list[int]) -> int: n = len(nums) if n < 3: return n return 1 << (int(math.log2(n)) + 1) Was this page helpful? Thanks for your feedback! Thanks for your feedback! Help us improve this page by using our feedback form.