LeetCode Biweekly Contest 10
問題文
省略
省略
C++に変換後のコードはこちら
#define main dummy_main
{}
#undef main
class Solution {
public:
vector<int> arraysIntersection(vector<int>& A, vector<int>& B, vector<int>& C) {
int a = 0, b = 0, c = 0, m;
vector<int> res;
while(a < A.size() && b < B.size() && c < C.size()){
if(A[a] == B[b] == C[c]){
res.push_back(A[a]);
a++; b++; c++;
} else {
m = min(A[a], B[b], C[c]);
if(m==A[a]) a++;
if(m==B[b]) b++;
if(m==C[c]) c++;
}
}
return res;
}
};
Current time: 2024年04月30日03時10分57秒
Last modified: 2019年10月06日03時50分16秒 (by laycrs)
Tags: Competitive_Programming_Incomplete LeetCode
トップページに戻る
Logged in as: unknown user (not login)