LeetCode 3065 | Minimum Operations to Exceed Threshold Value I Explained Step by Step (C++)

Опубликовано: 25 Июнь 2026
на канале: Tulya Jain
0

🚀 About Me

I’m a Computer Engineering student and an aspiring full stack developer.
I solve LeetCode problems regularly and explain them in a simple, beginner-friendly way to improve problem-solving skills step by step.

🧠 Question Details

Question Number: 3065
Question Name: Minimum Operations to Exceed Threshold Value I

📖 Problem Explanation

In this problem, we are given:

an integer array nums
an integer k

Our task is:
👉 count how many elements are smaller than k.

Because:
👉 every element smaller than k
needs one operation.

🧩 Example

Input:

nums = [2,11,10,1,3]
k = 10

Numbers smaller than 10:

2, 1, 3

Total count:

3

👉 Output:

3
💡 Approach
Traverse the array
Check every element
If current element is smaller than k
👉 increase count
Return total count at the end

👉 Time Complexity: O(n)
👉 Space Complexity: O(1)

🔗 Links

LinkedIn:   / tulya-jain-b84827372  
LeetCode Profile: https://leetcode.com/u/o08s0tJtFp/
GitHub Profile: https://github.com/jaintulya