LeetCode solutions

3331. Minimum Operations to Exceed Threshold Value I

My accepted C++ solution to LeetCode problem 3331, Minimum Operations to Exceed Threshold Value I, running in 0ms.

  • Difficulty: Easy
  • C++
  • Runtime 0ms
  • Memory 24.9MB

Read the problem on LeetCode View on GitHub

C++

Accepted on LeetCode — runtime 0ms, memory 24.9MB, accepted 2025-12-27.

cpp
class Solution {
    public:
    int minOperations(vector<int>& nums, int k) {
        int count = 0;
        for (int n : nums) {
            if (n < k) count++;
        }
        return count;
    }
};

Source