FPEvalDataset/LeetCodeProblem
0304
1{2 "id": 3704,3 "name": "count_partitions_with_even_sum_difference",4 "difficulty": "Easy",5 "link": "https://leetcode.com/problems/count-partitions-with-even-sum-difference/",6 "date": "2025-01-19 00:00:00",7 "task_description": "You are given an integer array `nums` of length `n`. A **partition** is defined as an index `i` where `0 <= i < n - 1`, splitting the array into two **non-empty** subarrays such that: Left subarray contains indices `[0, i]`. Right subarray contains indices `[i + 1, n - 1]`. Return the number of **partitions** where the **difference** between the **sum** of the left and right subarrays is **even**. **Example 1:** **Input:** nums = [10,10,3,7,6] **Output:** 4 **Explanation:** The 4 partitions are: `[10]`, `[10, 3, 7, 6]` with a sum difference of `10 - 26 = -16`, which is even. `[10, 10]`, `[3, 7, 6]` with a sum difference of `20 - 16 = 4`, which is even. `[10, 10, 3]`, `[7, 6]` with a sum difference of `23 - 13 = 10`, which is even. `[10, 10, 3, 7]`, `[6]` with a sum difference of `30 - 6 = 24`, which is even. **Example 2:** **Input:** nums = [1,2,2] **Output:** 0 **Explanation:** No partition results in an even sum difference. **Example 3:** **Input:** nums = [2,4,6,8] **Output:** 3 **Explanation:** All partitions result in an even sum difference. **Constraints:** `2 <= n == nums.length <= 100` `1 <= nums[i] <= 100`",8 "public_test_cases": [9 {10 "label": "Example 1",11 "input": "nums = [10,10,3,7,6]",12 "output": "4 "13 },14 {15 "label": "Example 2",16 "input": "nums = [1,2,2]",17 "output": "0 "18 },19 {20 "label": "Example 3",21 "input": "nums = [2,4,6,8]",22 "output": "3 "23 }24 ],25 "private_test_cases": [26 {27 "input": [28 52,29 48,30 75,31 98,32 57,33 68,34 78,35 16,36 15,37 63,38 22,39 68,40 84,41 83,42 7,43 96,44 28,45 6,46 39,47 42,48 5,49 91,50 27,51 89,52 51,53 22,54 61,55 69,56 14,57 4,58 46,59 48,60 72,61 7,62 33,63 22,64 16,65 1,66 6,67 56,68 2,69 84,70 68,71 27,72 84,73 13,74 100,75 98,76 88,77 35,78 60,79 79,80 2,81 78,82 76,83 40,84 17,85 39,86 32,87 3,88 8,89 23,90 79,91 76,92 73,93 64,94 32,95 58,96 5,97 89,98 71,99 43,100 45101 ],102 "output": 72103 },104 {105 "input": [106 87,107 41,108 31,109 40,110 93,111 87,112 72,113 75,114 22,115 83,116 59,117 93,118 51,119 79,120 57,121 45,122 69,123 34,124 28,125 63,126 70,127 75,128 43,129 63,130 11,131 5,132 88,133 28,134 74,135 11136 ],137 "output": 0138 },139 {140 "input": [141 35,142 13,143 9,144 30,145 94,146 30,147 5,148 33,149 33,150 93,151 21,152 61,153 93,154 57,155 37,156 15,157 58,158 6,159 22,160 20,161 19,162 67,163 63164 ],165 "output": 22166 },167 {168 "input": [169 56,170 19,171 68,172 86,173 70,174 24,175 82,176 91,177 92,178 80,179 43,180 48,181 81,182 3,183 16,184 57,185 2,186 56,187 66,188 58,189 2,190 31,191 57,192 61,193 36,194 100,195 41,196 13,197 1,198 84,199 58,200 91,201 95,202 23,203 98,204 5,205 51,206 48,207 19,208 29,209 65,210 27,211 49,212 89,213 56,214 9,215 78,216 43,217 31,218 60,219 68,220 73221 ],222 "output": 0223 },224 {225 "input": [226 15,227 11,228 3,229 6,230 81,231 52,232 74,233 97,234 100,235 67,236 68,237 47,238 83,239 68,240 75,241 75,242 70,243 99,244 62,245 62,246 51,247 60,248 40,249 62,250 97,251 49,252 60,253 94,254 41,255 87,256 99,257 76,258 73,259 28,260 78,261 20,262 69,263 98,264 2,265 23,266 64,267 99,268 72,269 68,270 84,271 88,272 29,273 22,274 50,275 56,276 56,277 20,278 52,279 43,280 100,281 8,282 17,283 87,284 10,285 55,286 57,287 81,288 79,289 84,290 57,291 12,292 44,293 62,294 92,295 89,296 56,297 94,298 13,299 48,300 35,301 12,302 43,303 35,304 72,305 56306 ],307 "output": 0308 },309 {310 "input": [311 55,312 1,313 32,314 65,315 3,316 46,317 72,318 75,319 91,320 42,321 81,322 30,323 25,324 96,325 15,326 30,327 23,328 28,329 55,330 23,331 20,332 36,333 81,334 38,335 4,336 91,337 22,338 68,339 1,340 63,341 2342 ],343 "output": 30344 },345 {346 "input": [347 15,348 3,349 73,350 9,351 8,352 90,353 94,354 77,355 26,356 3,357 38,358 16,359 40,360 17,361 6,362 40,363 92,364 56,365 14,366 13,367 81,368 60,369 58,370 21,371 92,372 49,373 39,374 71,375 89,376 87,377 6,378 88,379 39,380 84,381 24,382 54,383 24,384 71,385 77,386 53,387 16,388 2,389 34,390 28,391 33,392 69,393 77,394 89,395 63,396 49,397 42,398 85,399 79,400 31,401 78,402 41,403 86,404 33,405 36,406 91,407 53,408 58,409 89,410 83,411 97,412 59413 ],414 "output": 65415 },416 {417 "input": [418 96,419 52,420 76,421 66,422 45,423 3,424 15,425 70,426 2,427 49,428 16,429 2,430 74,431 79,432 54,433 93,434 25,435 91,436 85,437 62,438 7,439 98,440 66,441 1,442 31,443 86,444 9,445 25,446 78,447 99,448 64,449 13,450 4,451 64,452 14,453 3,454 70,455 47,456 78,457 63,458 76,459 45,460 67,461 89,462 69,463 92,464 11,465 76,466 34,467 60,468 92,469 18,470 44,471 35,472 72,473 82,474 71,475 53,476 2,477 6,478 36,479 29,480 9,481 23,482 84,483 64,484 53,485 89,486 60,487 68,488 11,489 14,490 21,491 65,492 41,493 57,494 50,495 20,496 92,497 84,498 91,499 25,500 52,501 55,502 51,503 76,504 80,505 45,506 53,507 14,508 40,509 27,510 51,511 1,512 51,513 16,514 52,515 25,516 83,517 7518 ],519 "output": 99520 },521 {522 "input": [523 51,524 42,525 23,526 66,527 95,528 47,529 17,530 21,531 6,532 60,533 7,534 45,535 7,536 61,537 55,538 21,539 70,540 79,541 4,542 46,543 4,544 62,545 71,546 90,547 70,548 47,549 72,550 6,551 79,552 76,553 98,554 70,555 69,556 62,557 93,558 77,559 3,560 58,561 67,562 40,563 65,564 87,565 86,566 70,567 78,568 61,569 22,570 20,571 40,572 44,573 47,574 27,575 76,576 25,577 63,578 70,579 94,580 14,581 38,582 54,583 81,584 76,585 58,586 40,587 86,588 15,589 16,590 93,591 33,592 56,593 34,594 14595 ],596 "output": 71597 },598 {599 "input": [600 40,601 91,602 86,603 12,604 31,605 79,606 93,607 29,608 27,609 12,610 8,611 96,612 13,613 49,614 5,615 5,616 63,617 85618 ],619 "output": 17620 }621 ],622 "haskell_template": "countPartitions :: [Int] -> Int\ncountPartitions nums ",623 "ocaml_template": "let countPartitions (nums: int list) : int = ",624 "scala_template": "def countPartitions(nums: List[Int]): Int = { \n \n}",625 "java_template": "class Solution {\n public int countPartitions(int[] nums) {\n \n }\n}",626 "python_template": "class Solution(object):\n def countPartitions(self, nums):\n \"\"\"\n :type nums: List[int]\n :rtype: int\n \"\"\"\n "627}