FPEvalDataset/LeetCodeProblem
0305
1{2 "id": 2527,3 "name": "count_subarrays_with_fixed_bounds",4 "difficulty": "Hard",5 "link": "https://leetcode.com/problems/count-subarrays-with-fixed-bounds/",6 "date": "1665273600000",7 "task_description": "You are given an integer array `nums` and two integers `minK` and `maxK`. A **fixed-bound subarray** of `nums` is a subarray that satisfies the following conditions: The **minimum** value in the subarray is equal to `minK`. The **maximum** value in the subarray is equal to `maxK`. Return _the **number** of fixed-bound subarrays_. A **subarray** is a **contiguous** part of an array. **Example 1:** ``` **Input:** nums = [1,3,5,2,7,5], minK = 1, maxK = 5 **Output:** 2 **Explanation:** The fixed-bound subarrays are [1,3,5] and [1,3,5,2]. ``` **Example 2:** ``` **Input:** nums = [1,1,1,1], minK = 1, maxK = 1 **Output:** 10 **Explanation:** Every subarray of nums is a fixed-bound subarray. There are 10 possible subarrays. ``` **Constraints:** `2 <= nums.length <= 105` `1 <= nums[i], minK, maxK <= 106`",8 "public_test_cases": [9 {10 "label": "Example 1",11 "input": "nums = [1,3,5,2,7,5], minK = 1, maxK = 5",12 "output": "2 "13 },14 {15 "label": "Example 2",16 "input": "nums = [1,1,1,1], minK = 1, maxK = 1",17 "output": "10 "18 }19 ],20 "private_test_cases": [21 {22 "input": [23 [24 386055,25 328262,26 578770,27 84579,28 41863,29 641490,30 601102,31 685117,32 451094,33 157592,34 226381,35 938146,36 673654,37 816424,38 194982,39 294240,40 164180,41 853629,42 78962,43 348433,44 286035,45 764505,46 838707,47 184235,48 135703,49 597475,50 94714,51 951013,52 463215,53 371478,54 411410,55 738702,56 689117,57 255436,58 816961,59 602207,60 126918,61 1932,62 117608,63 823905,64 574735,65 750634,66 538101,67 60767768 ],69 850178,70 93274571 ],72 "output": 073 },74 {75 "input": [76 [77 609792,78 570514,79 834538,80 321561,81 844707,82 395259,83 248623,84 28899,85 757527,86 234418,87 284955,88 834090,89 433148,90 720816,91 96886,92 987961,93 779993,94 555810,95 925741,96 581642,97 247164,98 85187,99 963810100 ],101 228547,102 530353103 ],104 "output": 0105 },106 {107 "input": [108 [109 733806,110 458772,111 402035,112 761574,113 322988,114 259924,115 17153,116 19346,117 848831,118 371603,119 244944,120 583333,121 198160,122 901690,123 459892,124 37339,125 317669,126 462098,127 922532,128 127333,129 624184,130 952118131 ],132 515712,133 814694134 ],135 "output": 0136 },137 {138 "input": [139 [140 623451,141 94947,142 74030,143 803974,144 336848,145 981546,146 250593,147 993470,148 191578,149 48441,150 501493,151 388471,152 310767,153 747862,154 888145,155 916598,156 882502,157 382930,158 413655,159 694127,160 58935,161 459286,162 25573,163 439444,164 53114,165 208590,166 640696,167 38248,168 940733,169 124052,170 39529,171 975374,172 634191,173 608929,174 211940,175 294390,176 279558,177 89073,178 827650,179 826422,180 770598,181 409007,182 209559,183 977096,184 727885,185 40829,186 284959,187 850896,188 386635,189 440038,190 525770,191 540947,192 327490,193 110157,194 658205,195 944131,196 934275,197 982370,198 500350,199 53968,200 995892,201 43536,202 565621,203 914469,204 644596,205 736788,206 743089,207 657566,208 360938,209 537814,210 869084,211 211281,212 547085,213 661522,214 439131,215 332231,216 568914,217 92726218 ],219 410870,220 893195221 ],222 "output": 0223 },224 {225 "input": [226 [227 138662,228 608236,229 318934,230 469861,231 756184,232 372630,233 188358,234 974703,235 960814,236 81235,237 517631,238 911337,239 444499,240 918570,241 900584,242 182499,243 378450,244 124649,245 374013,246 278946,247 881508,248 883358,249 293915,250 515216,251 230952,252 834886,253 774304,254 324040,255 626037,256 29295,257 978065,258 493309,259 986867,260 331847,261 760207,262 851215,263 723365,264 883148,265 419712,266 30558,267 180168,268 497171,269 313045,270 134411,271 353159,272 402233,273 460280,274 39904,275 465524,276 145703,277 477073,278 736502,279 21202,280 248652,281 646868,282 548986,283 176099,284 677740,285 890981,286 887484,287 646032,288 836826,289 959779,290 146011,291 701208,292 928092,293 799338,294 487477,295 832695,296 841160,297 853623,298 742250,299 6196,300 268882,301 545571,302 909806,303 321861,304 9810,305 626048,306 694043,307 388142,308 975761,309 118005,310 857287,311 686600,312 842193,313 831046,314 512542,315 768295,316 333475,317 962098,318 894062,319 510315320 ],321 497651,322 674030323 ],324 "output": 0325 },326 {327 "input": [328 [329 983134,330 890418,331 587396,332 943513,333 425109,334 876931,335 754347,336 990452,337 561393,338 809836,339 24234,340 585329,341 202469,342 199966,343 984185,344 465074,345 423937,346 945190,347 588029,348 126743,349 611886,350 444683,351 82646,352 767199,353 453722,354 389355,355 360048,356 710808,357 962529,358 946423,359 438125,360 908238,361 349308,362 721227,363 645930,364 554217,365 472124,366 986030,367 877382,368 740535,369 202829,370 640732,371 843439,372 764945,373 457358,374 630273,375 827249376 ],377 439319,378 474398379 ],380 "output": 0381 },382 {383 "input": [384 [385 604363,386 260210,387 124405,388 87488,389 582644,390 26952,391 276250,392 196784,393 994876,394 223692,395 904763,396 689454,397 318752,398 997090,399 788943,400 926267,401 229520,402 278261,403 496770,404 376516,405 39331,406 609427,407 479786,408 470649,409 649228,410 108682,411 416622,412 941365,413 233699,414 919806,415 857879,416 248747,417 706421,418 219746,419 284748,420 703548,421 556981,422 954593,423 377309,424 489273,425 515168,426 757447,427 528892,428 671368,429 65322,430 171229,431 24596,432 367703,433 314555,434 212865,435 91430436 ],437 94012,438 166238439 ],440 "output": 0441 },442 {443 "input": [444 [445 952415,446 157755,447 278643,448 263222,449 484889,450 997235,451 714755,452 43439,453 180460,454 742327,455 927054,456 668967,457 228293,458 3589,459 733227,460 864553,461 624427,462 397639,463 273372,464 112630,465 906738,466 334990,467 507007,468 814765,469 579768,470 215278,471 684611,472 430868,473 709478,474 47497,475 262649,476 781242,477 508445,478 46742,479 948801,480 401717,481 698850,482 744156,483 966599,484 377098,485 700988,486 830391,487 269079,488 434126,489 493284490 ],491 569627,492 741395493 ],494 "output": 0495 },496 {497 "input": [498 [499 360909,500 828436,501 400550,502 594802,503 197177,504 26543,505 645299,506 847052,507 100541,508 809931,509 887933,510 674184,511 584607,512 770104,513 84134,514 60055,515 264329,516 571197,517 942617,518 108589,519 558318,520 487837,521 520989,522 868559,523 175496,524 759119,525 129318,526 431762,527 797994,528 638657,529 884491,530 254371,531 864946,532 392152,533 481035,534 426722,535 563680,536 3870,537 410770,538 668801,539 83276,540 803486,541 685602,542 671628,543 397962,544 748073,545 803118,546 888378,547 816134,548 996710,549 359415,550 654347,551 400922,552 384601553 ],554 142415,555 862453556 ],557 "output": 0558 },559 {560 "input": [561 [562 986076,563 745188,564 112637,565 601835,566 876526,567 278159,568 249592,569 754955,570 240974,571 539323,572 312417,573 514427,574 488090,575 825300,576 551796,577 637430,578 983233,579 772492,580 477179,581 886424,582 543396,583 99680,584 369901,585 362233,586 790562,587 279349,588 413351,589 657532,590 958535,591 441474,592 690026,593 999240,594 420446,595 669557,596 638585,597 353249,598 107791,599 16093,600 481396,601 252383,602 400514,603 323453,604 858467,605 406359,606 121348,607 647820,608 97323,609 430118,610 919119,611 266850,612 702963,613 954750,614 143191,615 429305,616 510857,617 176838,618 14532,619 238891,620 851044,621 53876,622 202292,623 512939,624 633742,625 229675,626 762842,627 271902,628 876370,629 602166,630 560051,631 331399,632 435949,633 838822,634 964890,635 631563,636 254371,637 467499,638 367574,639 510599,640 710033,641 343811,642 136946,643 619967,644 485166,645 128512646 ],647 469805,648 523062649 ],650 "output": 0651 }652 ],653 "haskell_template": "countSubarrays :: [Int] -> Int -> Int -> Int\ncountSubarrays nums minK maxK ",654 "ocaml_template": "let countSubarrays (nums: int list) (minK: int) (maxK: int) : int = ",655 "scala_template": "def countSubarrays(nums: List[Int],minK: Int,maxK: Int): Int = { \n \n}",656 "java_template": "public static int countSubarrays(List<Integer> nums, int minK, int maxK) {\n\n}",657 "python_template": "class Solution(object):\n def countSubarrays(self, nums, minK, maxK):\n \"\"\"\n :type nums: List[int]\n :type minK: int\n :type maxK: int\n :rtype: int\n \"\"\"\n "658}