FPEvalDataset/LeetCodeProblem
0304
1{2 "id": 2436,3 "name": "make_array_zero_by_subtracting_equal_amounts",4 "difficulty": "Easy",5 "link": "https://leetcode.com/problems/make-array-zero-by-subtracting-equal-amounts/",6 "date": "1658620800000",7 "task_description": "You are given a non-negative integer array `nums`. In one operation, you must: Choose a positive integer `x` such that `x` is less than or equal to the **smallest non-zero** element in `nums`. Subtract `x` from every **positive** element in `nums`. Return _the **minimum** number of operations to make every element in _`nums`_ equal to _`0`. **Example 1:** ``` **Input:** nums = [1,5,0,3,5] **Output:** 3 **Explanation:** In the first operation, choose x = 1. Now, nums = [0,4,0,2,4]. In the second operation, choose x = 2. Now, nums = [0,2,0,0,2]. In the third operation, choose x = 2. Now, nums = [0,0,0,0,0]. ``` **Example 2:** ``` **Input:** nums = [0] **Output:** 0 **Explanation:** Each element in nums is already 0 so no operations are needed. ``` **Constraints:** `1 <= nums.length <= 100` `0 <= nums[i] <= 100`",8 "public_test_cases": [9 {10 "label": "Example 1",11 "input": "nums = [1,5,0,3,5]",12 "output": "3 "13 },14 {15 "label": "Example 2",16 "input": "nums = [0]",17 "output": "0 "18 }19 ],20 "private_test_cases": [21 {22 "input": [23 36,24 40,25 69,26 52,27 6,28 42,29 16,30 99,31 80,32 35,33 97,34 31,35 68,36 58,37 66,38 94,39 19,40 96,41 74,42 68,43 71,44 16,45 17,46 10,47 91,48 57,49 40,50 42,51 66,52 20,53 68,54 6,55 88,56 3757 ],58 "output": 2759 },60 {61 "input": [62 46,63 44,64 31,65 50,66 39,67 46,68 29,69 25,70 70,71 36,72 0,73 69,74 90,75 30,76 84,77 83,78 23,79 11,80 2,81 80,82 91,83 87,84 27,85 27,86 51,87 68,88 38,89 78,90 39,91 45,92 68,93 66,94 49,95 94,96 91,97 28,98 41,99 19,100 33,101 82,102 92,103 90,104 30,105 81,106 63,107 63,108 52,109 24,110 43,111 57,112 78,113 80,114 86,115 3,116 76,117 72,118 88,119 40,120 85,121 55,122 29,123 92,124 30,125 75,126 58,127 3,128 92129 ],130 "output": 51131 },132 {133 "input": [134 0,135 94,136 59,137 65,138 19,139 41,140 54,141 89,142 51,143 84,144 97,145 15,146 87,147 72,148 16,149 7,150 36,151 96,152 24,153 100,154 70,155 95,156 34,157 6,158 60,159 2,160 81,161 35,162 82,163 89,164 88,165 96,166 12,167 21,168 37,169 47,170 44,171 86,172 50,173 12,174 55,175 54,176 49,177 61,178 75179 ],180 "output": 40181 },182 {183 "input": [184 69,185 47,186 89,187 11,188 21,189 14,190 79,191 56,192 45,193 83,194 79,195 61,196 39,197 72,198 36,199 87,200 25,201 50,202 81,203 89,204 24,205 55,206 72,207 33,208 26,209 89,210 13,211 43,212 2,213 23,214 95,215 78,216 53,217 70,218 13,219 41220 ],221 "output": 31222 },223 {224 "input": [225 56,226 86,227 51,228 47,229 71,230 72,231 55,232 74,233 33,234 75,235 20,236 65,237 60,238 31,239 16,240 50,241 43,242 0,243 45,244 79,245 83,246 88,247 63,248 86,249 0,250 43,251 65252 ],253 "output": 22254 },255 {256 "input": [257 26,258 11,259 29,260 100,261 28,262 59,263 10,264 53,265 71,266 90,267 41,268 12,269 86,270 3,271 55,272 35,273 74,274 1,275 64,276 100,277 25,278 54,279 38,280 74,281 4,282 10,283 25,284 41,285 99,286 84,287 36,288 45,289 67,290 81,291 25,292 78,293 71,294 89,295 66,296 17,297 6,298 51,299 28,300 5,301 42,302 16,303 98,304 26,305 6306 ],307 "output": 39308 },309 {310 "input": [311 24,312 4,313 29,314 24,315 61,316 68,317 77,318 40,319 24,320 54,321 56,322 41,323 41,324 74,325 23,326 54,327 57,328 78,329 4,330 7,331 34,332 35,333 76,334 4,335 32,336 18,337 11,338 27,339 59,340 82,341 100,342 68343 ],344 "output": 25345 },346 {347 "input": [348 16,349 22,350 93,351 97,352 5,353 77,354 47,355 76,356 98,357 71,358 18,359 17,360 95,361 0,362 33,363 84,364 12,365 83,366 66,367 54,368 28,369 47,370 1,371 43,372 39,373 26,374 82,375 86,376 88,377 96,378 75,379 26,380 34,381 8,382 56,383 96384 ],385 "output": 32386 },387 {388 "input": [389 58,390 4,391 39,392 72,393 42,394 63,395 32,396 51,397 3,398 80,399 91,400 42,401 8,402 74,403 51,404 36,405 43,406 23,407 80,408 55,409 22,410 74,411 96,412 72,413 26,414 23,415 63,416 59,417 5,418 78,419 55,420 39,421 48,422 41,423 91,424 70,425 27,426 49,427 51,428 58,429 55,430 81,431 24,432 55,433 2,434 15,435 12,436 6,437 44,438 9,439 93,440 73,441 33,442 21,443 89,444 47,445 84,446 36,447 100,448 53,449 77,450 79,451 90,452 54453 ],454 "output": 49455 },456 {457 "input": [458 43,459 83,460 39,461 100,462 9,463 9,464 5,465 55,466 85,467 0,468 75,469 8,470 3,471 100,472 60,473 31,474 37,475 79,476 30,477 48,478 27,479 40,480 29,481 45,482 50,483 89,484 22,485 99,486 54,487 24,488 16,489 91,490 51,491 36,492 7,493 88,494 94,495 0,496 100,497 11,498 57,499 44,500 52,501 53,502 75,503 2,504 42,505 14,506 99,507 67,508 81,509 21,510 49,511 16,512 29,513 46514 ],515 "output": 47516 }517 ],518 "haskell_template": "minimumOperations :: [Int] -> Int\nminimumOperations nums ",519 "ocaml_template": "let minimumOperations (nums: int list) : int = ",520 "scala_template": "def minimumOperations(nums: List[Int]): Int = { \n \n}",521 "java_template": "public static int minimumOperations(List<Integer> nums) {\n\n}",522 "python_template": "class Solution(object):\n def minimumOperations(self, nums):\n \"\"\"\n :type nums: List[int]\n :rtype: int\n \"\"\"\n "523}