You are viewing a single comment's thread. Return to all comments →
vector solve(vector a) { int n = a.size(); map mp; mp[a[0]]++; for(int i=1;i
vector<int> ans; for(int i=0;i<n;i++){ int flag=1; for(int j=a[i]; j<=a[n-1];j=j+a[i]){ if(mp.find(j)==mp.end()){ flag=0; break; } } if(flag==1 && (a[n-1]%a[i]==0||a[i]==1)) ans.push_back((a[i])); } return ans;
}
Seems like cookies are disabled on this browser, please enable them to open this website
Bus Station
You are viewing a single comment's thread. Return to all comments →
vector solve(vector a) { int n = a.size(); map mp; mp[a[0]]++; for(int i=1;i
}