
算法
文章平均质量分 65
mofei12138
这个作者很懒,什么都没留下…
展开
-
leetcode 330 Patching Array
原题链接:Patching Array - LeetCode题目Given a sorted integer array nums and an integer n, add/patch elements to the array such that any number in the range [1, n] inclusive can be formed by the sum of some elements in the array.Return the minimum number of pa原创 2022-03-17 22:26:19 · 336 阅读 · 0 评论 -
leetcode 96 Unique Binary Search Trees
原题链接:Unique Binary Search Trees - LeetCode题目Given an integer n, return *the number of structurally unique **BST’*s (binary search trees) which has exactly n nodes of unique values from 1 to n.Example 1:Input: n = 3Output: 5Example 2:Input: n = 1Ou原创 2021-12-11 18:42:16 · 232 阅读 · 0 评论 -
动态规划的两种实现形式
动态规划动态规划与分治方法相似,都是通过组合子问题的解来求解原问题。动态规划是分治方法的特例,应用于子问题重叠的情况。在这种情况下,分治算法会反复求解这些重叠的子问题。而动态规划算法对每个子问题只求解一次,将其解保存下来,而无需每次都计算。动态规划的实现有两种形式:递推形式和递归形式。原创 2021-07-11 21:57:37 · 1526 阅读 · 0 评论