일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | ||||
4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 | 12 | 13 | 14 | 15 | 16 | 17 |
18 | 19 | 20 | 21 | 22 | 23 | 24 |
25 | 26 | 27 | 28 | 29 | 30 | 31 |
Tags
- leetcode
- zeros
- 조지아텍
- 방통대
- 캐나다 영주권
- cpp
- LAA
- 개발자
- C++
- LV1
- 딥러닝
- mpnp
- 알고리즘
- Plotting
- 프로그래머스
- Deep learning
- machine learning
- EOI
- 방송통신대학교
- MATLAB
- 선형대수
- 컴퓨터과학과
- 코딩테스트
- 기본
- 온라인석사
- 머신러닝
- 주정부이민
- 매트랩
- omscs
- 마니토바
Archives
- Today
- Total
Krononberg
1829. Maximum XOR for Each Query.cpp 본문
class Solution {
public:
vector<int> getMaximumXor(vector<int>& nums, int maximumBit) {
vector<int>res;
int len = nums.size();
int x = pow(2,maximumBit)-1;
int tmp=0;
for(int i =0; i< len; i++){
tmp = tmp^nums[i];
res.push_back(tmp ^ x);
}
reverse(res.begin(),res.end());
return res;
}
};
'개발 로그 > 알고리즘' 카테고리의 다른 글
701. Insert into a Binary Search Tree.cpp (0) | 2021.10.08 |
---|---|
1641. Count Sorted Vowel Strings.cpp (0) | 2021.10.08 |
1748. Sum of Unique Elements.cpp (0) | 2021.10.08 |
961. N-Repeated Element in Size 2N Array.cpp (0) | 2021.10.08 |
589. N-ary Tree Preorder Traversal.cpp (0) | 2021.10.08 |