leetcode.com 2023-10-21
🔴1425.constrained-subsequence-sum
🏷️ Tags
#queue #array #dynamic_programming #sliding_window #monotonic_queue #heap_priority_queue
🔴1425.constrained-subsequence-sum
🏷️ Tags
#queue #array #dynamic_programming #sliding_window #monotonic_queue #heap_priority_queue
Telegraph
constrained-subsequence-sum
Given an integer array nums and an integer k, return the maximum sum of a non-empty subsequence of that array such that for every two consecutive integers in the subsequence, nums[i] and nums[j], where i < j, the condition j - i <= k is satisfied. A subsequence…
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…
leetcode.com 2023-10-24
🟡515.find-largest-value-in-each-tree-row
🏷️ Tags
#tree #depth_first_search #breadth_first_search #binary_tree
🟡515.find-largest-value-in-each-tree-row
🏷️ Tags
#tree #depth_first_search #breadth_first_search #binary_tree
Telegraph
find-largest-value-in-each-tree-row
Given the root of a binary tree, return an array of the largest value in each row of the tree (0-indexed). Example 1: Input: root = [1,3,2,5,3,null,9] Output: [1,3,9] Example 2: Input: root = [1,2,3] Output: [1,3] Constraints:
leetcode.com 2023-10-26
🟡823.binary-trees-with-factors
🏷️ Tags
#array #hash_table #dynamic_programming #sorting
🟡823.binary-trees-with-factors
🏷️ Tags
#array #hash_table #dynamic_programming #sorting
Telegraph
binary-trees-with-factors
Given an array of unique integers, arr, where each integer arr[i] is strictly greater than 1. We make a binary tree using these integers, and each number may be used for any number of times. Each non-leaf node's value should be equal to the product of the…
leetcode.cn 2023-10-27
🟡1465.maximum-area-of-a-piece-of-cake-after-horizontal-and-vertical-cuts
🏷️ Tags
#greedy #array #sorting
🟡1465.maximum-area-of-a-piece-of-cake-after-horizontal-and-vertical-cuts
🏷️ Tags
#greedy #array #sorting
Telegraph
maximum-area-of-a-piece-of-cake-after-horizontal-and-vertical-cuts
矩形蛋糕的高度为 h 且宽度为 w,给你两个整数数组 horizontalCuts 和 verticalCuts,其中:
leetcode.cn 2023-10-28
🟢2558.take-gifts-from-the-richest-pile
🏷️ Tags
#array #simulation #heap_priority_queue
🟢2558.take-gifts-from-the-richest-pile
🏷️ Tags
#array #simulation #heap_priority_queue
Telegraph
take-gifts-from-the-richest-pile
给你一个整数数组 gifts ,表示各堆礼物的数量。每一秒,你需要执行以下操作:
leetcode.com 2023-10-30
🟢1356.sort-integers-by-the-number-of-1-bits
🏷️ Tags
#bit_manipulation #array #counting #sorting
🟢1356.sort-integers-by-the-number-of-1-bits
🏷️ Tags
#bit_manipulation #array #counting #sorting
Telegraph
sort-integers-by-the-number-of-1-bits
You are given an integer array arr. Sort the integers in the array in ascending order by the number of 1's in their binary representation and in case of two or more integers have the same number of 1's you have to sort them in ascending order. Return the…
leetcode.cn 2023-10-31
🔴2003.smallest-missing-genetic-value-in-each-subtree
🏷️ Tags
#tree #depth_first_search #union_find #dynamic_programming
🔴2003.smallest-missing-genetic-value-in-each-subtree
🏷️ Tags
#tree #depth_first_search #union_find #dynamic_programming
Telegraph
smallest-missing-genetic-value-in-each-subtree
有一棵根节点为 0 的 家族树 ,总共包含 n 个节点,节点编号为 0 到 n - 1 。给你一个下标从 0 开始的整数数组 parents ,其中 parents[i] 是节点 i 的父节点。由于节点 0 是 根 ,所以 parents[0] == -1 。 总共有 105 个基因值,每个基因值都用 闭区间 [1, 105] 中的一个整数表示。给你一个下标从 0 开始的整数数组 nums ,其中 nums[i] 是节点 i 的基因值,且基因值 互不相同 。 请你返回一个数组 ans ,长度为 n ,其…