leetcode.cn 2025-09-26
🟡611.valid-triangle-number
🏷️ Tags
#greedy #array #two_pointers #binary_search #sorting
🟡611.valid-triangle-number
🏷️ Tags
#greedy #array #two_pointers #binary_search #sorting
Telegraph
valid-triangle-number
给定一个包含非负整数的数组 nums ,返回其中可以组成三角形三条边的三元组个数。 示例 1: 输入: nums = [2,2,3,4] 输出: 3 解释:有效的组合是: 2,3,4 (使用第一个 2) 2,3,4 (使用第二个 2) 2,2,3 示例 2: 输入: nums = [4,2,3,4] 输出: 4 提示:
leetcode.com 2025-09-26
🟡611.valid-triangle-number
🏷️ Tags
#greedy #array #two_pointers #binary_search #sorting
🟡611.valid-triangle-number
🏷️ Tags
#greedy #array #two_pointers #binary_search #sorting
Telegraph
valid-triangle-number
Given an integer array nums, return the number of triplets chosen from the array that can make triangles if we take them as side lengths of a triangle. Example 1: Input: nums = [2,2,3,4] Output: 3 Explanation: Valid combinations are: 2,3,4 (using the first…
leetcode.cn 2025-10-06
🔴778.swim-in-rising-water
🏷️ Tags
#depth_first_search #breadth_first_search #union_find #array #binary_search #matrix #heap_priority_queue
🔴778.swim-in-rising-water
🏷️ Tags
#depth_first_search #breadth_first_search #union_find #array #binary_search #matrix #heap_priority_queue
Telegraph
swim-in-rising-water
在一个 n x n 的整数矩阵 grid 中,每一个方格的值 grid[i][j] 表示位置 (i, j) 的平台高度。 当开始下雨时,在时间为 t 时,水池中的水位为 t 。你可以从一个平台游向四周相邻的任意一个平台,但是前提是此时水位必须同时淹没这两个平台。假定你可以瞬间移动无限距离,也就是默认在方格内部游动是不耗时的。当然,在你游泳的时候你必须待在坐标方格里面。 你从坐标方格的左上平台 (0,0) 出发。返回 你到达坐标方格的右下平台 (n-1, n-1) 所需的最少时间 。 示例 1: 输入:…
leetcode.com 2025-10-06
🔴778.swim-in-rising-water
🏷️ Tags
#depth_first_search #breadth_first_search #union_find #array #binary_search #matrix #heap_priority_queue
🔴778.swim-in-rising-water
🏷️ Tags
#depth_first_search #breadth_first_search #union_find #array #binary_search #matrix #heap_priority_queue
Telegraph
swim-in-rising-water
You are given an n x n integer matrix grid where each value grid[i][j] represents the elevation at that point (i, j). It starts raining, and water gradually rises over time. At time t, the water level is t, meaning any cell with elevation less than equal…
leetcode.com 2025-10-07
🟡1488.avoid-flood-in-the-city
🏷️ Tags
#greedy #array #hash_table #binary_search #heap_priority_queue
🟡1488.avoid-flood-in-the-city
🏷️ Tags
#greedy #array #hash_table #binary_search #heap_priority_queue
Telegraph
avoid-flood-in-the-city
Your country has an infinite number of lakes. Initially, all the lakes are empty, but when it rains over the nth lake, the nth lake becomes full of water. If it rains over a lake that is full of water, there will be a flood. Your goal is to avoid floods in…
leetcode.cn 2025-10-08
🟡2300.successful-pairs-of-spells-and-potions
🏷️ Tags
#array #two_pointers #binary_search #sorting
🟡2300.successful-pairs-of-spells-and-potions
🏷️ Tags
#array #two_pointers #binary_search #sorting
Telegraph
successful-pairs-of-spells-and-potions
给你两个正整数数组 spells 和 potions ,长度分别为 n 和 m ,其中 spells[i] 表示第 i 个咒语的能量强度,potions[j] 表示第 j 瓶药水的能量强度。 同时给你一个整数 success 。一个咒语和药水的能量强度 相乘 如果 大于等于 success ,那么它们视为一对 成功 的组合。 请你返回一个长度为 n 的整数数组 pairs,其中 pairs[i] 是能跟第 i 个咒语成功组合的 药水 数目。 示例 1: 输入:spells = [5,1,3], potions…
leetcode.com 2025-10-08
🟡2300.successful-pairs-of-spells-and-potions
🏷️ Tags
#array #two_pointers #binary_search #sorting
🟡2300.successful-pairs-of-spells-and-potions
🏷️ Tags
#array #two_pointers #binary_search #sorting
Telegraph
successful-pairs-of-spells-and-potions
You are given two positive integer arrays spells and potions, of length n and m respectively, where spells[i] represents the strength of the ith spell and potions[j] represents the strength of the jth potion. You are also given an integer success. A spell…
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…
leetcode.cn 2025-10-21
🟡3346.maximum-frequency-of-an-element-after-performing-operations-i
🏷️ Tags
#array #binary_search #prefix_sum #sorting #sliding_window
🟡3346.maximum-frequency-of-an-element-after-performing-operations-i
🏷️ Tags
#array #binary_search #prefix_sum #sorting #sliding_window
Telegraph
maximum-frequency-of-an-element-after-performing-operations-i
给你一个整数数组 nums 和两个整数 k 和 numOperations 。 你必须对 nums 执行 操作 numOperations 次。每次操作中,你可以:
leetcode.com 2025-10-21
🟡3346.maximum-frequency-of-an-element-after-performing-operations-i
🏷️ Tags
#array #binary_search #prefix_sum #sorting #sliding_window
🟡3346.maximum-frequency-of-an-element-after-performing-operations-i
🏷️ Tags
#array #binary_search #prefix_sum #sorting #sliding_window
Telegraph
maximum-frequency-of-an-element-after-performing-operations-i
You are given an integer array nums and two integers k and numOperations. You must perform an operation numOperations times on nums, where in each operation you:
leetcode.cn 2025-10-22
🔴3347.maximum-frequency-of-an-element-after-performing-operations-ii
🏷️ Tags
#array #binary_search #prefix_sum #sorting #sliding_window
🔴3347.maximum-frequency-of-an-element-after-performing-operations-ii
🏷️ Tags
#array #binary_search #prefix_sum #sorting #sliding_window
Telegraph
maximum-frequency-of-an-element-after-performing-operations-ii
给你一个整数数组 nums 和两个整数 k 和 numOperations 。 你必须对 nums 执行 操作 numOperations 次。每次操作中,你可以:
leetcode.com 2025-10-22
🔴3347.maximum-frequency-of-an-element-after-performing-operations-ii
🏷️ Tags
#array #binary_search #prefix_sum #sorting #sliding_window
🔴3347.maximum-frequency-of-an-element-after-performing-operations-ii
🏷️ Tags
#array #binary_search #prefix_sum #sorting #sliding_window
Telegraph
maximum-frequency-of-an-element-after-performing-operations-ii
You are given an integer array nums and two integers k and numOperations. You must perform an operation numOperations times on nums, where in each operation you:
leetcode.cn 2025-11-07
🔴2528.maximize-the-minimum-powered-city
🏷️ Tags
#greedy #queue #array #binary_search #prefix_sum #sliding_window
🔴2528.maximize-the-minimum-powered-city
🏷️ Tags
#greedy #queue #array #binary_search #prefix_sum #sliding_window
Telegraph
maximize-the-minimum-powered-city
给你一个下标从 0 开始长度为 n 的整数数组 stations ,其中 stations[i] 表示第 i 座城市的供电站数目。 每个供电站可以在一定 范围 内给所有城市提供电力。换句话说,如果给定的范围是 r ,在城市 i 处的供电站可以给所有满足 |i - j| <= r 且 0 <= i, j <= n - 1 的城市 j 供电。
leetcode.com 2025-11-07
🔴2528.maximize-the-minimum-powered-city
🏷️ Tags
#greedy #queue #array #binary_search #prefix_sum #sliding_window
🔴2528.maximize-the-minimum-powered-city
🏷️ Tags
#greedy #queue #array #binary_search #prefix_sum #sliding_window
Telegraph
maximize-the-minimum-powered-city
You are given a 0-indexed integer array stations of length n, where stations[i] represents the number of power stations in the ith city. Each power station can provide power to every city in a fixed range. In other words, if the range is denoted by r, then…
leetcode.cn 2025-12-01
🔴2141.maximum-running-time-of-n-computers
🏷️ Tags
#greedy #array #binary_search #sorting
🔴2141.maximum-running-time-of-n-computers
🏷️ Tags
#greedy #array #binary_search #sorting
Telegraph
maximum-running-time-of-n-computers
你有 n 台电脑。给你整数 n 和一个下标从 0 开始的整数数组 batteries ,其中第 i 个电池可以让一台电脑 运行 batteries[i] 分钟。你想使用这些电池让 全部 n 台电脑 同时 运行。 一开始,你可以给每台电脑连接 至多一个电池 。然后在任意整数时刻,你都可以将一台电脑与它的电池断开连接,并连接另一个电池,你可以进行这个操作 任意次 。新连接的电池可以是一个全新的电池,也可以是别的电脑用过的电池。断开连接和连接新的电池不会花费任何时间。 注意,你不能给电池充电。 请你返回你可以让…
leetcode.com 2025-12-01
🔴2141.maximum-running-time-of-n-computers
🏷️ Tags
#greedy #array #binary_search #sorting
🔴2141.maximum-running-time-of-n-computers
🏷️ Tags
#greedy #array #binary_search #sorting
Telegraph
maximum-running-time-of-n-computers
You have n computers. You are given the integer n and a 0-indexed integer array batteries where the ith battery can run a computer for batteries[i] minutes. You are interested in running all n computers simultaneously using the given batteries. Initially…
❤1