leetcode.com 2023-06-16
🔴1569.number-of-ways-to-reorder-array-to-get-same-bst
🏷️ Tags
#tree #union_find #binary_search_tree #memoization #array #math #divide_and_conquer #dynamic_programming #binary_tree #combinatorics
🔴1569.number-of-ways-to-reorder-array-to-get-same-bst
🏷️ Tags
#tree #union_find #binary_search_tree #memoization #array #math #divide_and_conquer #dynamic_programming #binary_tree #combinatorics
Telegraph
number-of-ways-to-reorder-array-to-get-same-bst
Given an array nums that represents a permutation of integers from 1 to n. We are going to construct a binary search tree (BST) by inserting the elements of nums in order into an initially empty BST. Find the number of different ways to reorder nums so that…
leetcode.com 2023-06-18
🔴2328.number-of-increasing-paths-in-a-grid
🏷️ Tags
#depth_first_search #breadth_first_search #graph #topological_sort #memoization #array #dynamic_programming #matrix
🔴2328.number-of-increasing-paths-in-a-grid
🏷️ Tags
#depth_first_search #breadth_first_search #graph #topological_sort #memoization #array #dynamic_programming #matrix
Telegraph
number-of-increasing-paths-in-a-grid
You are given an m x n integer matrix grid, where you can move from a cell to any adjacent cell in all 4 directions. Return the number of strictly increasing paths in the grid such that you can start from any cell and end at any cell. Since the answer may…
leetcode.cn 2023-06-24
🔴1659.maximize-grid-happiness
🏷️ Tags
#bit_manipulation #memoization #dynamic_programming #bitmask
🔴1659.maximize-grid-happiness
🏷️ Tags
#bit_manipulation #memoization #dynamic_programming #bitmask
Telegraph
maximize-grid-happiness
给你四个整数 m、n、introvertsCount 和 extrovertsCount 。有一个 m x n 网格,和两种类型的人:内向的人和外向的人。总共有 introvertsCount 个内向的人和 extrovertsCount 个外向的人。 请你决定网格中应当居住多少人,并为每个人分配一个网格单元。 注意,不必 让所有人都生活在网格中。 每个人的 幸福感 计算如下:
leetcode.com 2023-06-25
🔴1575.count-all-possible-routes
🏷️ Tags
#memoization #array #dynamic_programming
🔴1575.count-all-possible-routes
🏷️ Tags
#memoization #array #dynamic_programming
Telegraph
count-all-possible-routes
You are given an array of distinct positive integers locations where locations[i] represents the position of city i. You are also given integers start, finish and fuel representing the starting city, ending city, and the initial amount of fuel you have, respectively.…
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.com 2023-08-04
🟡139.word-break
🏷️ Tags
#trie #memoization #array #hash_table #string #dynamic_programming
🟡139.word-break
🏷️ Tags
#trie #memoization #array #hash_table #string #dynamic_programming
Telegraph
word-break
Given a string s and a dictionary of strings wordDict, return true if s can be segmented into a space-separated sequence of one or more dictionary words. Note that the same word in the dictionary may be reused multiple times in the segmentation. Example…
leetcode.cn 2023-08-17
🔴1444.number-of-ways-of-cutting-a-pizza
🏷️ Tags
#memoization #array #dynamic_programming #matrix
🔴1444.number-of-ways-of-cutting-a-pizza
🏷️ Tags
#memoization #array #dynamic_programming #matrix
Telegraph
number-of-ways-of-cutting-a-pizza
给你一个 rows x cols 大小的矩形披萨和一个整数 k ,矩形包含两种字符: 'A' (表示苹果)和 '.' (表示空白格子)。你需要切披萨 k-1 次,得到 k 块披萨并送给别人。 切披萨的每一刀,先要选择是向垂直还是水平方向切,再在矩形的边界上选一个切的位置,将披萨一分为二。如果垂直地切披萨,那么需要把左边的部分送给一个人,如果水平地切,那么需要把上面的部分送给一个人。在切完最后一刀后,需要把剩下来的一块送给最后一个人。 请你返回确保每一块披萨包含 至少 一个苹果的切披萨方案数。由于答案可能是个很大的数字,请你返回它对…
leetcode.com 2023-11-30
🔴1611.minimum-one-bit-operations-to-make-integers-zero
🏷️ Tags
#bit_manipulation #memoization #dynamic_programming
🔴1611.minimum-one-bit-operations-to-make-integers-zero
🏷️ Tags
#bit_manipulation #memoization #dynamic_programming
Telegraph
minimum-one-bit-operations-to-make-integers-zero
Given an integer n, you must transform it into 0 using the following operations any number of times:
leetcode.cn 2025-05-26
🔴1857.largest-color-value-in-a-directed-graph
🏷️ Tags
#graph #topological_sort #memoization #hash_table #dynamic_programming #counting
🔴1857.largest-color-value-in-a-directed-graph
🏷️ Tags
#graph #topological_sort #memoization #hash_table #dynamic_programming #counting
Telegraph
largest-color-value-in-a-directed-graph
给你一个 有向图 ,它含有 n 个节点和 m 条边。节点编号从 0 到 n - 1 。 给你一个字符串 colors ,其中 colors[i] 是小写英文字母,表示图中第 i 个节点的 颜色 (下标从 0 开始)。同时给你一个二维数组 edges ,其中 edges[j] = [aj, bj] 表示从节点 aj 到节点 bj 有一条 有向边 。 图中一条有效 路径 是一个点序列 x1 -> x2 -> x3 -> ... -> xk ,对于所有 1 <= i < k ,从 xi 到 xi+1 在图中有一条有向边。路径的…
leetcode.com 2025-05-26
🔴1857.largest-color-value-in-a-directed-graph
🏷️ Tags
#graph #topological_sort #memoization #hash_table #dynamic_programming #counting
🔴1857.largest-color-value-in-a-directed-graph
🏷️ Tags
#graph #topological_sort #memoization #hash_table #dynamic_programming #counting
Telegraph
largest-color-value-in-a-directed-graph
There is a directed graph of n colored nodes and m edges. The nodes are numbered from 0 to n - 1. You are given a string colors where colors[i] is a lowercase English letter representing the color of the ith node in this graph (0-indexed). You are also given…
leetcode.cn 2025-06-26
🟡2311.longest-binary-subsequence-less-than-or-equal-to-k
🏷️ Tags
#greedy #memoization #string #dynamic_programming
🟡2311.longest-binary-subsequence-less-than-or-equal-to-k
🏷️ Tags
#greedy #memoization #string #dynamic_programming
Telegraph
longest-binary-subsequence-less-than-or-equal-to-k
给你一个二进制字符串 s 和一个正整数 k 。 请你返回 s 的 最长 子序列的长度,且该子序列对应的 二进制 数字小于等于 k 。 注意:
leetcode.com 2025-06-26
🟡2311.longest-binary-subsequence-less-than-or-equal-to-k
🏷️ Tags
#greedy #memoization #string #dynamic_programming
🟡2311.longest-binary-subsequence-less-than-or-equal-to-k
🏷️ Tags
#greedy #memoization #string #dynamic_programming
Telegraph
longest-binary-subsequence-less-than-or-equal-to-k
You are given a binary string s and a positive integer k. Return the length of the longest subsequence of s that makes up a binary number less than or equal to k. Note:
leetcode.cn 2025-07-12
🔴1900.the-earliest-and-latest-rounds-where-players-compete
🏷️ Tags
#memoization #dynamic_programming
🔴1900.the-earliest-and-latest-rounds-where-players-compete
🏷️ Tags
#memoization #dynamic_programming
Telegraph
the-earliest-and-latest-rounds-where-players-compete
n 名运动员参与一场锦标赛,所有运动员站成一排,并根据 最开始的 站位从 1 到 n 编号(运动员 1 是这一排中的第一个运动员,运动员 2 是第二个运动员,依此类推)。 锦标赛由多个回合组成(从回合 1 开始)。每一回合中,这一排从前往后数的第 i 名运动员需要与从后往前数的第 i 名运动员比拼,获胜者将会进入下一回合。如果当前回合中运动员数目为奇数,那么中间那位运动员将轮空晋级下一回合。
leetcode.com 2025-07-12
🔴1900.the-earliest-and-latest-rounds-where-players-compete
🏷️ Tags
#memoization #dynamic_programming
🔴1900.the-earliest-and-latest-rounds-where-players-compete
🏷️ Tags
#memoization #dynamic_programming
Telegraph
the-earliest-and-latest-rounds-where-players-compete
There is a tournament where n players are participating. The players are standing in a single row and are numbered from 1 to n based on their initial standing position (player 1 is the first player in the row, player 2 is the second player in the row, etc.).…
leetcode.cn 2025-08-27
🔴3459.length-of-longest-v-shaped-diagonal-segment
🏷️ Tags
#memoization #array #dynamic_programming #matrix
🔴3459.length-of-longest-v-shaped-diagonal-segment
🏷️ Tags
#memoization #array #dynamic_programming #matrix
Telegraph
length-of-longest-v-shaped-diagonal-segment
给你一个大小为 n x m 的二维整数矩阵 grid,其中每个元素的值为 0、1 或 2。 V 形对角线段 定义如下:
leetcode.com 2025-08-27
🔴3459.length-of-longest-v-shaped-diagonal-segment
🏷️ Tags
#memoization #array #dynamic_programming #matrix
🔴3459.length-of-longest-v-shaped-diagonal-segment
🏷️ Tags
#memoization #array #dynamic_programming #matrix
Telegraph
length-of-longest-v-shaped-diagonal-segment
You are given a 2D integer matrix grid of size n x m, where each element is either 0, 1, or 2. A V-shaped diagonal segment is defined as:
leetcode.cn 2025-11-08
🔴1611.minimum-one-bit-operations-to-make-integers-zero
🏷️ Tags
#bit_manipulation #memoization #dynamic_programming
🔴1611.minimum-one-bit-operations-to-make-integers-zero
🏷️ Tags
#bit_manipulation #memoization #dynamic_programming
Telegraph
minimum-one-bit-operations-to-make-integers-zero
给你一个整数 n,你需要重复执行多次下述操作将其转换为 0 :
leetcode.com 2025-11-08
🔴1611.minimum-one-bit-operations-to-make-integers-zero
🏷️ Tags
#bit_manipulation #memoization #dynamic_programming
🔴1611.minimum-one-bit-operations-to-make-integers-zero
🏷️ Tags
#bit_manipulation #memoization #dynamic_programming
Telegraph
minimum-one-bit-operations-to-make-integers-zero
Given an integer n, you must transform it into 0 using the following operations any number of times: