FPEvalDataset/LeetCodeProblem
0304
1{2 "id": 3437,3 "name": "maximum_total_damage_with_spell_casting",4 "difficulty": "Medium",5 "link": "https://leetcode.com/problems/maximum-total-damage-with-spell-casting/",6 "date": "2024-06-09 00:00:00",7 "task_description": "A magician has various spells. You are given an array `power`, where each element represents the damage of a spell. Multiple spells can have the same damage value. It is a known fact that if a magician decides to cast a spell with a damage of `power[i]`, they **cannot** cast any spell with a damage of `power[i] - 2`, `power[i] - 1`, `power[i] + 1`, or `power[i] + 2`. Each spell can be cast **only once**. Return the **maximum** possible _total damage_ that a magician can cast. **Example 1:** **Input:** power = [1,1,3,4] **Output:** 6 **Explanation:** The maximum possible damage of 6 is produced by casting spells 0, 1, 3 with damage 1, 1, 4. **Example 2:** **Input:** power = [7,1,6,6] **Output:** 13 **Explanation:** The maximum possible damage of 13 is produced by casting spells 1, 2, 3 with damage 1, 6, 6. **Constraints:** `1 <= power.length <= 105` `1 <= power[i] <= 109`",8 "public_test_cases": [9 {10 "label": "Example 1",11 "input": "power = [1,1,3,4]",12 "output": "6 "13 },14 {15 "label": "Example 2",16 "input": "power = [7,1,6,6]",17 "output": "13 "18 }19 ],20 "private_test_cases": [21 {22 "input": [23 21299376,24 30326510,25 65124747,26 68919829,27 75772091,28 97455751,29 103104027,30 114940791,31 125810811,32 183852728,33 203239084,34 225580364,35 245862059,36 271112832,37 273722687,38 276740659,39 293107239,40 295558401,41 301633179,42 302512193,43 343540214,44 356662193,45 370340791,46 378791463,47 381393855,48 385871343,49 406689383,50 406782693,51 408592542,52 424790254,53 441459405,54 455992132,55 460383415,56 464228395,57 478979503,58 486580652,59 492775151,60 496580729,61 512881280,62 519192476,63 541198475,64 544752254,65 568895705,66 576673552,67 585223210,68 585963593,69 587631906,70 609107334,71 631024777,72 650629852,73 651930535,74 670027956,75 690825828,76 693582361,77 728002478,78 728580909,79 733422712,80 742658489,81 743006784,82 743836750,83 746328599,84 766681853,85 773945176,86 777990908,87 778009375,88 787526975,89 804097903,90 804543299,91 817408176,92 824816570,93 832654664,94 849881991,95 852878240,96 872182445,97 909895027,98 912300914,99 915200784,100 918312981,101 922180219,102 922681396,103 930643593,104 942707833,105 945321279,106 958554136,107 963901846,108 965244012109 ],110 "output": 47751048881111 },112 {113 "input": [114 48999430,115 143388196116 ],117 "output": 192387626118 },119 {120 "input": [121 7762031,122 26454122,123 35008073,124 47711579,125 97773868,126 109683458,127 110361383,128 144360429,129 153718444,130 154424909,131 165221971,132 172413458,133 181755198,134 191092944,135 193470607,136 195742895,137 201478564,138 208878959,139 210206414,140 223616787,141 240498987,142 251799297,143 272466274,144 284331607,145 293858238,146 294116154,147 307716277,148 317306197,149 322507768,150 324469182,151 326014917,152 333747827,153 371059495,154 373420503,155 373898718,156 388131348,157 389198139,158 400237709,159 427179881,160 434849353,161 436237780,162 439240908,163 451664033,164 459332136,165 480910151,166 484967743,167 524164489,168 526636766,169 532703295,170 546757636,171 562162939,172 587306501,173 594467382,174 623152467,175 654310010,176 670032547,177 681207872,178 684456623,179 711191775,180 764373966,181 785493354,182 788960649,183 795259659,184 801606286,185 807861195,186 808407234,187 810747367,188 812693422,189 812824534,190 859193659,191 872907838,192 892735434,193 893359215,194 906564391,195 915519882,196 925158996,197 928671346,198 946257709,199 952260300,200 956507346,201 971212076,202 975778472,203 976435669,204 991690853,205 999516767206 ],207 "output": 43160844636208 },209 {210 "input": [211 3431904,212 4572425,213 16042438,214 25640282,215 26015941,216 34443076,217 52297523,218 61958551,219 70668642,220 85174558,221 85864706,222 87298831,223 98970018,224 101583702,225 101740575,226 133365887,227 145504264,228 165640021,229 168497135,230 173871377,231 178544921,232 178632680,233 179799714,234 189387806,235 193382561,236 210903415,237 245853988,238 255414979,239 258087091,240 260583088,241 283349757,242 284248403,243 290268196,244 292085053,245 295141646,246 296248843,247 301372218,248 305500496,249 310668166,250 312929411,251 314004620,252 315254052,253 315881227,254 328197039,255 334329605,256 339061974,257 340339646,258 348726024,259 351357473,260 352023251,261 357876859,262 369265756,263 387667964,264 394926156,265 408027870,266 411919999,267 411927236,268 435522424,269 441611723,270 480311417,271 484531757,272 485222052,273 496706153,274 502131990,275 509109644,276 510690275,277 519070433,278 524301512,279 524994561,280 525987322,281 560424752,282 582112240,283 588762665,284 588824392,285 623061754,286 634763664,287 639152563,288 643797128,289 645155695,290 655693326,291 660702558,292 691325136,293 703729436,294 706967414,295 710560626,296 711329215,297 741976936,298 750032955,299 752070250,300 769817075,301 778996573,302 797297686,303 813482434,304 874202030,305 886248129,306 906265666,307 915229125,308 951405883,309 955615221,310 955799071,311 959599468,312 982562634,313 984269542,314 987217437,315 997957754316 ],317 "output": 46392370735318 },319 {320 "input": [321 18081711,322 26810830,323 71891401,324 73030300,325 103918217,326 109177716,327 109440781,328 118588747,329 125753108,330 131586476,331 139821013,332 145814685,333 150780353,334 185464278,335 197099083,336 200989923,337 201514962,338 203859106,339 204285982,340 208436215,341 238610252,342 240028109,343 249697789,344 258840884,345 268752069,346 299206159,347 300952394,348 320718170,349 331661228,350 334430362,351 362547798,352 369491651,353 370980465,354 374221643,355 385941309,356 447873180,357 448103280,358 488142971,359 488975922,360 503282679,361 515908111,362 520649370,363 541738978,364 548839743,365 549993268,366 557362755,367 570405795,368 597828413,369 603265785,370 610901832,371 613320813,372 628135733,373 632233180,374 634089546,375 634784447,376 664733076,377 676502231,378 698503088,379 726141077,380 730032664,381 734502351,382 753343870,383 756812576,384 789722134,385 793267296,386 809390807,387 821294707,388 821471200,389 823780006,390 823828792,391 825312404,392 830157731,393 838624419,394 856473492,395 861463556,396 879956630,397 882114951,398 887495565,399 889419523,400 890248023,401 898008853,402 913093953,403 960998158,404 963277260,405 982595267,406 985789687,407 991802304408 ],409 "output": 45328418621410 }411 ],412 "haskell_template": "maximumTotalDamage :: [Int] -> Int\nmaximumTotalDamage power ",413 "ocaml_template": "let maximumTotalDamage (power: int list) : int = ",414 "scala_template": "def maximumTotalDamage(power: List[Int]): Int = { \n \n}",415 "java_template": "class Solution {\n public long maximumTotalDamage(int[] power) {\n \n }\n}",416 "python_template": "class Solution(object):\n def maximumTotalDamage(self, power):\n \"\"\"\n :type power: List[int]\n :rtype: int\n \"\"\"\n "417}