leetcode.com 2023-07-23
🟡894.all-possible-full-binary-trees
🏷️ Tags
#tree #recursion #memoization #dynamic_programming #binary_tree
🟡894.all-possible-full-binary-trees
🏷️ Tags
#tree #recursion #memoization #dynamic_programming #binary_tree
Telegraph
all-possible-full-binary-trees
Given an integer n, return a list of all possible full binary trees with n nodes. Each node of each tree in the answer must have Node.val == 0. Each element of the answer is the root node of one possible tree. You may return the final list of trees in any…
leetcode.cn 2023-07-25
🟡2208.minimum-operations-to-halve-array-sum
🏷️ Tags
#greedy #array #heap_priority_queue
🟡2208.minimum-operations-to-halve-array-sum
🏷️ Tags
#greedy #array #heap_priority_queue
Telegraph
minimum-operations-to-halve-array-sum
给你一个正整数数组 nums 。每一次操作中,你可以从 nums 中选择 任意 一个数并将它减小到 恰好 一半。(注意,在后续操作中你可以对减半过的数继续执行操作) 请你返回将 nums 数组和 至少 减少一半的 最少 操作数。 示例 1: 输入:nums = [5,19,8,1] 输出:3 解释:初始 nums 的和为 5 + 19 + 8 + 1 = 33 。 以下是将数组和减少至少一半的一种方法: 选择数字 19 并减小为 9.5 。 选择数字 9.5 并减小为 4.75 。 选择数字 8 并减小为…
leetcode.com 2023-07-27
🔴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…
leetcode.cn 2023-07-28
🔴2050.parallel-courses-iii
🏷️ Tags
#graph #topological_sort #array #dynamic_programming
🔴2050.parallel-courses-iii
🏷️ Tags
#graph #topological_sort #array #dynamic_programming
Telegraph
parallel-courses-iii
给你一个整数 n ,表示有 n 节课,课程编号从 1 到 n 。同时给你一个二维整数数组 relations ,其中 relations[j] = [prevCoursej, nextCoursej] ,表示课程 prevCoursej 必须在课程 nextCoursej 之前 完成(先修课的关系)。同时给你一个下标从 0 开始的整数数组 time ,其中 time[i] 表示完成第 (i+1) 门课程需要花费的 月份 数。 请你根据以下规则算出完成所有课程所需要的 最少 月份数:
leetcode.com 2023-07-28
🟡486.predict-the-winner
🏷️ Tags
#recursion #array #math #dynamic_programming #game_theory
🟡486.predict-the-winner
🏷️ Tags
#recursion #array #math #dynamic_programming #game_theory
Telegraph
predict-the-winner
You are given an integer array nums. Two players are playing a game with this array: player 1 and player 2. Player 1 and player 2 take turns, with player 1 starting first. Both players start the game with a score of 0. At each turn, the player takes one of…
leetcode.com 2023-07-31
🟡712.minimum-ascii-delete-sum-for-two-strings
🏷️ Tags
#string #dynamic_programming
🟡712.minimum-ascii-delete-sum-for-two-strings
🏷️ Tags
#string #dynamic_programming
Telegraph
minimum-ascii-delete-sum-for-two-strings
Given two strings s1 and s2, return the lowest ASCII sum of deleted characters to make two strings equal. Example 1: Input: s1 = "sea", s2 = "eat" Output: 231 Explanation: Deleting "s" from "sea" adds the ASCII value of "s" (115) to the sum. Deleting "t"…