go: add «1863. Sum of All Subset XOR Totals»

URL:	https://leetcode.com/problems/sum-of-all-subset-xor-totals/
Signed-off-by: Matej Focko <me@mfocko.xyz>
This commit is contained in:
Matej Focko 2025-04-05 14:01:39 +02:00
parent c6b7b034de
commit 23deeef141
Signed by: mfocko
SSH key fingerprint: SHA256:icm0fIOSJUpy5+1x23sfr+hLtF9UhY8VpMC7H4WFJP8

View file

@ -0,0 +1,9 @@
package main
func subsetXORSum(nums []int) int {
result := 0
for _, x := range nums {
result |= x
}
return result << (len(nums) - 1)
}