vector<int> commomValue(vector<int> a, vector<int> b) { vector<int> ret; int m = a.size(); int n = b.size(); int i = 0, j = 0; while(i < m && j < n) { if(a[i] == b[j]) { ret.push_back(a[i]); ++i; ++j; } else if(a[i] < b[j]) ++i; else ++j; } return ret; }