This commit is contained in:
2026-01-21 18:52:24 +08:00
parent 2797ee2b17
commit 04aa2ffc7d
2 changed files with 41 additions and 0 deletions

22
26/01/3315.cpp Normal file
View File

@@ -0,0 +1,22 @@
#include <vector>
class Solution {
public:
std::vector<int> minBitwiseArray(std::vector<int>& nums) {
std::vector<int> ans;
for(auto num:nums){
if (num == 2) {
ans.push_back(-1);
continue;
}
int temp = num;
int t=0;
while (temp & 1) {
t++;
temp >>= 1;
}
ans.push_back(num ^ (1 << (t-1)));
}
return ans;
}
};