Advertisement
phatboislym

Untitled

May 20th, 2024
403
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.23 KB | Source Code | 0 0
  1. def subsetXORSum(nums: list[int]) -> int:
  2.     size = len(nums)
  3.  
  4.     def DFS(i: int, xor: int) -> int:
  5.         if i == size:
  6.             return xor
  7.  
  8.         return DFS(i + 1, xor ^ nums[i]) + DFS(i + 1, xor)
  9.  
  10.     return DFS(0, 0)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement