You are viewing a single comment's thread. Return to all comments →
c++ C++ cpp
int main() { vector str = {"aba", "baba", "aba", "xzxb"}; vector query = {"aba", "xzxb", "ab"}; vector a; int counter=0;
for (string qry : query) { //cout << qry << endl; for (string strng : str) { if(strng == qry){ counter++; } } a.push_back(counter); counter=0; } // Display the updated vector for (int i : a) { cout << i << endl; } return 0; }
Seems like cookies are disabled on this browser, please enable them to open this website
Sparse Arrays
You are viewing a single comment's thread. Return to all comments →
c++ C++ cpp
int main() { vector str = {"aba", "baba", "aba", "xzxb"}; vector query = {"aba", "xzxb", "ab"}; vector a; int counter=0;