Bit XOR¶
Table of Contents¶
- 1486. XOR Operation in an Array (Easy)
- 1720. Decode XORed Array (Easy)
- 2433. Find The Original Array of Prefix Xor (Medium)
- 1310. XOR Queries of a Subarray (Medium)
- 2683. Neighboring Bitwise XOR (Medium)
- 1829. Maximum XOR for Each Query (Medium)
- 2997. Minimum Number of Operations to Make Array XOR Equal to K (Medium)
- 1442. Count Triplets That Can Form Two Arrays of Equal XOR (Medium)
- 2429. Minimize XOR (Medium)
- 2527. Find Xor-Beauty of Array (Medium)
- 2317. Maximum XOR After Operations (Medium)
- 2588. Count the Number of Beautiful Subarrays (Medium)
- 2564. Substring XOR Queries (Medium)
- 1734. Decode XORed Permutation (Medium)
- 2857. Count Pairs of Points With Distance k (Medium)
- 1803. Count Pairs With XOR in a Range (Hard)
- 3215. Count Triplets with Even XOR Set Bits II (Medium) 👑
1486. XOR Operation in an Array¶
-
LeetCode | LeetCode CH (Easy)
-
Tags: math, bit manipulation
1720. Decode XORed Array¶
-
LeetCode | LeetCode CH (Easy)
-
Tags: array, bit manipulation
2433. Find The Original Array of Prefix Xor¶
-
LeetCode | LeetCode CH (Medium)
-
Tags: array, bit manipulation
1310. XOR Queries of a Subarray¶
-
LeetCode | LeetCode CH (Medium)
-
Tags: array, bit manipulation, prefix sum
2683. Neighboring Bitwise XOR¶
-
LeetCode | LeetCode CH (Medium)
-
Tags: array, bit manipulation
1829. Maximum XOR for Each Query¶
-
LeetCode | LeetCode CH (Medium)
-
Tags: array, bit manipulation, prefix sum
2997. Minimum Number of Operations to Make Array XOR Equal to K¶
-
LeetCode | LeetCode CH (Medium)
-
Tags: array, bit manipulation
1442. Count Triplets That Can Form Two Arrays of Equal XOR¶
-
LeetCode | LeetCode CH (Medium)
-
Tags: array, hash table, math, bit manipulation, prefix sum
2429. Minimize XOR¶
-
LeetCode | LeetCode CH (Medium)
-
Tags: greedy, bit manipulation
2527. Find Xor-Beauty of Array¶
-
LeetCode | LeetCode CH (Medium)
-
Tags: array, math, bit manipulation
2317. Maximum XOR After Operations¶
-
LeetCode | LeetCode CH (Medium)
-
Tags: array, math, bit manipulation
2588. Count the Number of Beautiful Subarrays¶
-
LeetCode | LeetCode CH (Medium)
-
Tags: array, hash table, bit manipulation, prefix sum
nums = [4, 3, 1, 2, 4]
- In bianry
from collections import defaultdict
from typing import List
def beautifulSubarrays(nums: List[int]) -> int:
res, s = 0, 0
cnt = defaultdict(int)
cnt[0] = 1
for x in nums:
s ^= x
res += cnt[s]
cnt[s] += 1
return res
nums = [4, 3, 1, 2, 4]
print(beautifulSubarrays(nums)) # 2
2564. Substring XOR Queries¶
-
LeetCode | LeetCode CH (Medium)
-
Tags: array, hash table, string, bit manipulation
1734. Decode XORed Permutation¶
-
LeetCode | LeetCode CH (Medium)
-
Tags: array, bit manipulation
2857. Count Pairs of Points With Distance k¶
-
LeetCode | LeetCode CH (Medium)
-
Tags: array, hash table, bit manipulation
1803. Count Pairs With XOR in a Range¶
-
LeetCode | LeetCode CH (Hard)
-
Tags: array, bit manipulation, trie
3215. Count Triplets with Even XOR Set Bits II¶
-
LeetCode | LeetCode CH (Medium)
-
Tags: array, bit manipulation