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 ,其…
leetcode.cn 2023-11-01
🔴2127.maximum-employees-to-be-invited-to-a-meeting
🏷️ Tags
#depth_first_search #graph #topological_sort
🔴2127.maximum-employees-to-be-invited-to-a-meeting
🏷️ Tags
#depth_first_search #graph #topological_sort
Telegraph
maximum-employees-to-be-invited-to-a-meeting
一个公司准备组织一场会议,邀请名单上有 n 位员工。公司准备了一张 圆形 的桌子,可以坐下 任意数目 的员工。 员工编号为 0 到 n - 1 。每位员工都有一位 喜欢 的员工,每位员工 当且仅当 他被安排在喜欢员工的旁边,他才会参加会议。每位员工喜欢的员工 不会 是他自己。 给你一个下标从 0 开始的整数数组 favorite ,其中 favorite[i] 表示第 i 位员工喜欢的员工。请你返回参加会议的 最多员工数目 。 示例 1: 输入:favorite = [2,2,1,2] 输出:3 解释:…
leetcode.com 2023-11-01
🟢501.find-mode-in-binary-search-tree
🏷️ Tags
#tree #depth_first_search #binary_search_tree #binary_tree
🟢501.find-mode-in-binary-search-tree
🏷️ Tags
#tree #depth_first_search #binary_search_tree #binary_tree
Telegraph
find-mode-in-binary-search-tree
Given the root of a binary search tree (BST) with duplicates, return all the mode(s) (i.e., the most frequently occurred element) in it. If the tree has more than one mode, return them in any order. Assume a BST is defined as follows:
👍1