From b7d0c2caf8734189dc3d204319b5d8b4360aa6b2 Mon Sep 17 00:00:00 2001 From: carry Date: Tue, 14 Jan 2025 17:55:31 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E6=88=90=E6=AF=8F=E6=97=A5=E4=B8=80?= =?UTF-8?q?=E9=A2=98=EF=BC=9A=E8=B6=85=E8=BF=87=E9=98=88=E5=80=BC=E7=9A=84?= =?UTF-8?q?=E6=9C=80=E5=B0=91=E6=93=8D=E4=BD=9C=E6=95=B0=20I?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- minOperations.cpp | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 minOperations.cpp diff --git a/minOperations.cpp b/minOperations.cpp new file mode 100644 index 0000000..ef46372 --- /dev/null +++ b/minOperations.cpp @@ -0,0 +1,25 @@ +#include +#include + +using namespace std; + +class Solution { +public: + int minOperations(vector& nums, int k) { + int counter = 0; + for(auto i:nums){ + if(i < k){ + counter++; + } + } + return counter; + } +}; + +int main() { + Solution solution; + vector nums = {2,11,10,1,3}; + int k = 10; + cout << solution.minOperations(nums, k) << endl; + return 0; +} \ No newline at end of file