leetcode.cn 2025-10-03
🔴407.trapping-rain-water-ii
🏷️ Tags
#breadth_first_search #array #matrix #heap_priority_queue
🔴407.trapping-rain-water-ii
🏷️ Tags
#breadth_first_search #array #matrix #heap_priority_queue
Telegraph
trapping-rain-water-ii
给你一个 m x n 的矩阵,其中的值均为非负整数,代表二维高度图每个单元的高度,请计算图中形状最多能接多少体积的雨水。 示例 1: 输入: heightMap = [[1,4,3,1,3,2],[3,2,1,3,2,4],[2,3,3,2,3,1]] 输出: 4 解释: 下雨后,雨水将会被上图蓝色的方块中。总的接雨水量为1+2+1=4。 示例 2: 输入: heightMap = [[3,3,3,3,3],[3,2,2,2,3],[3,2,1,2,3],[3,2,2,2,3],[3,3,3,3,3]]…
leetcode.com 2025-10-03
🔴407.trapping-rain-water-ii
🏷️ Tags
#breadth_first_search #array #matrix #heap_priority_queue
🔴407.trapping-rain-water-ii
🏷️ Tags
#breadth_first_search #array #matrix #heap_priority_queue
Telegraph
trapping-rain-water-ii
Given an m x n integer matrix heightMap representing the height of each unit cell in a 2D elevation map, return the volume of water it can trap after raining. Example 1: Input: heightMap = [[1,4,3,1,3,2],[3,2,1,3,2,4],[2,3,3,2,3,1]] Output: 4 Explanation:…
leetcode.cn 2025-10-05
🟡417.pacific-atlantic-water-flow
🏷️ Tags
#depth_first_search #breadth_first_search #array #matrix
🟡417.pacific-atlantic-water-flow
🏷️ Tags
#depth_first_search #breadth_first_search #array #matrix
Telegraph
pacific-atlantic-water-flow
有一个 m × n 的矩形岛屿,与 太平洋 和 大西洋 相邻。 “太平洋” 处于大陆的左边界和上边界,而 “大西洋” 处于大陆的右边界和下边界。 这个岛被分割成一个由若干方形单元格组成的网格。给定一个 m x n 的整数矩阵 heights , heights[r][c] 表示坐标 (r, c) 上单元格 高于海平面的高度 。 岛上雨水较多,如果相邻单元格的高度 小于或等于 当前单元格的高度,雨水可以直接向北、南、东、西流向相邻单元格。水可以从海洋附近的任何单元格流入海洋。 返回网格坐标 result 的…
leetcode.com 2025-10-05
🟡417.pacific-atlantic-water-flow
🏷️ Tags
#depth_first_search #breadth_first_search #array #matrix
🟡417.pacific-atlantic-water-flow
🏷️ Tags
#depth_first_search #breadth_first_search #array #matrix
Telegraph
pacific-atlantic-water-flow
There is an m x n rectangular island that borders both the Pacific Ocean and Atlantic Ocean. The Pacific Ocean touches the island's left and top edges, and the Atlantic Ocean touches the island's right and bottom edges. The island is partitioned into a grid…
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-09
🟡3494.find-the-minimum-amount-of-time-to-brew-potions
🏷️ Tags
#array #prefix_sum #simulation
🟡3494.find-the-minimum-amount-of-time-to-brew-potions
🏷️ Tags
#array #prefix_sum #simulation
Telegraph
find-the-minimum-amount-of-time-to-brew-potions
给你两个长度分别为 n 和 m 的整数数组 skill 和 mana 。
leetcode.com 2025-10-09
🟡3494.find-the-minimum-amount-of-time-to-brew-potions
🏷️ Tags
#array #prefix_sum #simulation
🟡3494.find-the-minimum-amount-of-time-to-brew-potions
🏷️ Tags
#array #prefix_sum #simulation
Telegraph
find-the-minimum-amount-of-time-to-brew-potions
You are given two integer arrays, skill and mana, of length n and m, respectively. In a laboratory, n wizards must brew m potions in order. Each potion has a mana capacity mana[j] and must pass through all the wizards sequentially to be brewed properly. The…
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,伤害值分别为…