diff --git a/leetcode/1863.SumofAllSubsetXORTotals/sol.go b/leetcode/1863.SumofAllSubsetXORTotals/sol.go new file mode 100644 index 0000000..07f4e63 --- /dev/null +++ b/leetcode/1863.SumofAllSubsetXORTotals/sol.go @@ -0,0 +1,27 @@ +// https://leetcode.com/problems/sum-of-all-subset-xor-totals + +package main + +import ( + "fmt" +) + +func subsetXORSum(nums []int) int { + n := len(nums) + res := 0 + for i := 1; i < 1<>k&1 == 1 { + sum ^= v + } + } + res += sum + } + return res +} + +func main() { + nums := []int{5, 1, 6} + fmt.Println(subsetXORSum(nums)) +}