File tree Expand file tree Collapse file tree 2 files changed +28
-0
lines changed Expand file tree Collapse file tree 2 files changed +28
-0
lines changed Original file line number Diff line number Diff line change 2150
2150
3044|[ Most Frequent Prime] ( ./solutions/3044-most-frequent-prime.js ) |Medium|
2151
2151
3046|[ Split the Array] ( ./solutions/3046-split-the-array.js ) |Easy|
2152
2152
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|
2153
2154
3066|[ Minimum Operations to Exceed Threshold Value II] ( ./solutions/3066-minimum-operations-to-exceed-threshold-value-ii.js ) |Medium|
2154
2155
3068|[ Find the Maximum Sum of Node Values] ( ./solutions/3068-find-the-maximum-sum-of-node-values.js ) |Hard|
2155
2156
3105|[ Longest Strictly Increasing or Strictly Decreasing Subarray] ( ./solutions/3105-longest-strictly-increasing-or-strictly-decreasing-subarray.js ) |Easy|
Original file line number Diff line number Diff line change
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
+ } ;
You can’t perform that action at this time.
0 commit comments