Medium
Number of Unique XOR Triplets I — Python
Full explanation · Time O(logn) · Space O(1)
# Time: O(logn)
# Space: O(1)
# bit manipulation, math
class Solution(object):
def uniqueXorTriplets(self, nums):
"""
:type nums: List[int]
:rtype: int
"""
return 1<<len(nums).bit_length() if len(nums) >= 3 else len(nums)