You are viewing a single comment's thread. Return to all comments →
What do you think about recursive approach? I think its better code. For such small array sizes its not that much slower.
int between(vector < int > a, vector < int > b, int x){ if(x <= 100) { bool good_x = true; for(int i = 0; i < a.size(); ++i) good_x &= x%a[i] == 0; for(int i = 0; i < b.size(); ++i) good_x &= b[i]%x == 0; return good_x + between(a, b, x+1); } else return 0; }
Seems like cookies are disabled on this browser, please enable them to open this website
Between Two Sets
You are viewing a single comment's thread. Return to all comments →
What do you think about recursive approach? I think its better code. For such small array sizes its not that much slower.