일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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
- 딥러닝
- zeros
- 머신러닝
- 알고리즘
- 온라인석사
- C++
- 코딩테스트
- 컴퓨터과학과
- MATLAB
- LV1
- 방통대
- 주정부이민
- 선형대수
- EOI
- LAA
- 매트랩
- leetcode
- 방송통신대학교
- Deep learning
- Plotting
- mpnp
- omscs
- cpp
- 프로그래머스
- 캐나다 영주권
- 개발자
- 조지아텍
- 위니펙
- machine learning
- 기본
Archives
- Today
- Total
Byte by Byte
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 |