Good prefix sum question
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution {\npublic:\n    long long maximumOr(vector<int>& nums, int k) \n    {\n    sort(nums.begin(),nums.end());vector<int>arr;int n=nums.size();long long num=0;\n    vector<int>left(n+1,0);left[0]=0;vector<int>right(n+1,0);right[n]=0;long long maxi=0;\n    for(int i=1;i<=n;i++)left[i]=left[i-1]|nums[i-1];\n    for(int i=n-2;i>=0;i--)right[i]=right[i+1]|nums[i+1];int count=0;\n    for(int i=31;i>=0;i--)\n    {   for(int j=0;j<n;j++)\n        {if((nums[j]>>i)&1)count++,arr.push_back(j);}if(count>=1)break;\n    } \n    for(int i=0;i<arr.size();i++)\n    {   long long val=(long long)(nums[arr[i]]);\n        long long temp=(val<<k);\n        val=temp|left[arr[i]]|right[arr[i]];\n        maxi=max(maxi,val);\n    }  return maxi;\n    }\n};\n```
['C++']