SOLUTION INFO
C++ · main.cpp
class Solution {
public:
vector<int> findThePrefixCommonArray(vector<int>& A, vector<int>& B) {
long long l = 0, r = 0;
int N = (int)A.size();
for(int i = 0; i < N; ++i) {
l |= 1LL << A[i];
r |= 1LL << B[i];
A[i] = __builtin_popcountll(l & r);
}
return A;
}
};
SOLUTION DESCRIPTION
풀이 설명
등록된 풀이 설명이 없습니다.