leetcode.cn 2023-05-31
🟡1130.minimum-cost-tree-from-leaf-values
🏷️ Tags
#stack #greedy #array #dynamic_programming #monotonic_stack
🟡1130.minimum-cost-tree-from-leaf-values
🏷️ Tags
#stack #greedy #array #dynamic_programming #monotonic_stack
Telegraph
minimum-cost-tree-from-leaf-values
给你一个正整数数组 arr,考虑所有满足以下条件的二叉树:
leetcode.cn 2023-07-23
🔴42.trapping-rain-water
🏷️ Tags
#stack #array #two_pointers #dynamic_programming #monotonic_stack
🔴42.trapping-rain-water
🏷️ Tags
#stack #array #two_pointers #dynamic_programming #monotonic_stack
Telegraph
trapping-rain-water
给定 n 个非负整数表示每个宽度为 1 的柱子的高度图,计算按此排列的柱子,下雨之后能接多少雨水。 示例 1: 输入:height = [0,1,0,2,1,0,1,3,2,1,2,1] 输出:6 解释:上面是由数组 [0,1,0,2,1,0,1,3,2,1,2,1] 表示的高度图,在这种情况下,可以接 6 个单位的雨水(蓝色部分表示雨水)。 示例 2: 输入:height = [4,2,0,3,2,5] 输出:9 提示:
leetcode.com 2023-09-30
🟡456.132-pattern
🏷️ Tags
#stack #array #binary_search #ordered_set #monotonic_stack
🟡456.132-pattern
🏷️ Tags
#stack #array #binary_search #ordered_set #monotonic_stack
Telegraph
132-pattern
Given an array of n integers nums, a 132 pattern is a subsequence of three integers nums[i], nums[j] and nums[k] such that i < j < k and nums[i] < nums[k] < nums[j]. Return true if there is a 132 pattern in nums, otherwise, return false. Example 1: Input:…
leetcode.com 2023-10-22
🔴1793.maximum-score-of-a-good-subarray
🏷️ Tags
#stack #array #two_pointers #binary_search #monotonic_stack
🔴1793.maximum-score-of-a-good-subarray
🏷️ Tags
#stack #array #two_pointers #binary_search #monotonic_stack
Telegraph
maximum-score-of-a-good-subarray
You are given an array of integers nums (0-indexed) and an integer k. The score of a subarray (i, j) is defined as min(nums[i], nums[i+1], ..., nums[j]) * (j - i + 1). A good subarray is a subarray where i <= k <= j. Return the maximum possible score of a…