From 0c6c362b93e15cae85b77a5111ece03ba54debc3 Mon Sep 17 00:00:00 2001 From: Nssh855366 <99404880+Nssh855366@users.noreply.github.com> Date: Sun, 29 May 2022 09:08:20 +0800 Subject: [PATCH] Create Find odd int.cpp --- Find odd int.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 Find odd int.cpp diff --git a/Find odd int.cpp b/Find odd int.cpp new file mode 100644 index 0000000..3460f65 --- /dev/null +++ b/Find odd int.cpp @@ -0,0 +1,11 @@ +include <iostream> +#include <vector> +using namespace std; + +int findOdd(const std::vector<int>& numbers){ + for (int number : numbers){ + if (count(numbers.begin(), numbers.end(), number) % 2 != 0){ + return number; + } + } +}