Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Conjuntos - Comparar cantidad de elementos únicos en 2 vectores
/*Escribir una función que retorne true si dos vectores tienen la misma cantidad de elementos únicos, o false en caso contrario.*/ #include <iostream> #include <string> #include <set> #include <vector> using namespace std; bool mismaCant(vector<int> a1, vector<int> a2) { set<int> elementosa1; for (int n : a1) { elementosa1.insert(n); } set<int> elementosa2; for (int n : a2) { elementosa2.insert(n); } return elementosa1.size()==elementosa2.size(); } int main() { cout << mismaCant({1, 3, 4, 4, 4}, {2, 5, 7}) << endl; cout << mismaCant({9, 8, 7, 6}, {4, 4, 3, 1}) << endl; cout << mismaCant({2}, {3, 3, 3, 3, 3}) << endl; }
run
|
edit
|
history
|
help
0
1163. Last Substring in Lexicographical Order
TwoVarRegression
Avoiding visited networked paths
Test 9(2020)
typedef 2
bind function
at.cpp
string-Orderly words
unordered_map
mutable constexpr