Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit dbf84e1

Browse files
committed
Add solution #3065
1 parent 6c1c55a commit dbf84e1

File tree

2 files changed

+28
-0
lines changed

2 files changed

+28
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2150,6 +2150,7 @@
21502150
3044|[Most Frequent Prime](./solutions/3044-most-frequent-prime.js)|Medium|
21512151
3046|[Split the Array](./solutions/3046-split-the-array.js)|Easy|
21522152
3047|[Find the Largest Area of Square Inside Two Rectangles](./solutions/3047-find-the-largest-area-of-square-inside-two-rectangles.js)|Medium|
2153+
3065|[Minimum Operations to Exceed Threshold Value I](./solutions/3065-minimum-operations-to-exceed-threshold-value-i.js)|Easy|
21532154
3066|[Minimum Operations to Exceed Threshold Value II](./solutions/3066-minimum-operations-to-exceed-threshold-value-ii.js)|Medium|
21542155
3068|[Find the Maximum Sum of Node Values](./solutions/3068-find-the-maximum-sum-of-node-values.js)|Hard|
21552156
3105|[Longest Strictly Increasing or Strictly Decreasing Subarray](./solutions/3105-longest-strictly-increasing-or-strictly-decreasing-subarray.js)|Easy|
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
/**
2+
* 3065. Minimum Operations to Exceed Threshold Value I
3+
* https://leetcode.com/problems/minimum-operations-to-exceed-threshold-value-i/
4+
* Difficulty: Easy
5+
*
6+
* You are given a 0-indexed integer array nums, and an integer k.
7+
*
8+
* In one operation, you can remove one occurrence of the smallest element of nums.
9+
*
10+
* Return the minimum number of operations needed so that all elements of the array are greater
11+
* than or equal to k.
12+
*/
13+
14+
/**
15+
* @param {number[]} nums
16+
* @param {number} k
17+
* @return {number}
18+
*/
19+
var minOperations = function(nums, k) {
20+
let operations = 0;
21+
22+
for (const num of nums) {
23+
if (num < k) operations++;
24+
}
25+
26+
return operations;
27+
};

0 commit comments

Comments
 (0)