diff --git a/Lesson2-OddOccurrencesInArray b/Lesson2-OddOccurrencesInArray new file mode 100644 index 0000000..92fb1c3 --- /dev/null +++ b/Lesson2-OddOccurrencesInArray @@ -0,0 +1,24 @@ +#include +#include +#include + +using namespace std; + +int solution(vector &A) +{ + map mapa; + for( int i = 0; i < A.size(); ++i ) + { + mapa[ A.at(i) ]++; + if(mapa[ A.at(i) ] == 2 ) + mapa.erase( A.at(i) ); + } + + return (*mapa.begin()).first; +} + +int main(int argc, char *argv[]) +{ + vector input = {42, 1000000000, 42}; + solution( input ); +} \ No newline at end of file