Advertisement
nikunjsoni

1863

May 17th, 2021
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.25 KB | None | 0 0
  1. class Solution {
  2. public:
  3.     int subsetXORSum(vector<int>& nums) {
  4.         long long int ans = 0LL, p = 1LL;
  5.         for(auto num : nums)
  6.             ans |= num;
  7.         p = (1LL<<(nums.size()-1));
  8.         ans = ans * p;
  9.         return ans;
  10.     }
  11. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement