leetcode.cn 2025-10-11
🟡3186.maximum-total-damage-with-spell-casting
🏷️ Tags
#array #hash_table #two_pointers #binary_search #dynamic_programming #counting #sorting
🟡3186.maximum-total-damage-with-spell-casting
🏷️ Tags
#array #hash_table #two_pointers #binary_search #dynamic_programming #counting #sorting
Telegraph
maximum-total-damage-with-spell-casting
一个魔法师有许多不同的咒语。 给你一个数组 power ,其中每个元素表示一个咒语的伤害值,可能会有多个咒语有相同的伤害值。 已知魔法师使用伤害值为 power[i] 的咒语时,他们就 不能 使用伤害为 power[i] - 2 ,power[i] - 1 ,power[i] + 1 或者 power[i] + 2 的咒语。 每个咒语最多只能被使用 一次 。 请你返回这个魔法师可以达到的伤害值之和的 最大值 。 示例 1: 输入:power = [1,1,3,4] 输出:6 解释: 可以使用咒语 0,1,3,伤害值分别为…
leetcode.com 2025-10-11
🟡3186.maximum-total-damage-with-spell-casting
🏷️ Tags
#array #hash_table #two_pointers #binary_search #dynamic_programming #counting #sorting
🟡3186.maximum-total-damage-with-spell-casting
🏷️ Tags
#array #hash_table #two_pointers #binary_search #dynamic_programming #counting #sorting
Telegraph
maximum-total-damage-with-spell-casting
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…