随笔分类 - LeetCode
摘要:简单dp。状态转移方程:dp[i] = max(dp[i-2] + nums[i], dp[i-1]);
阅读全文
摘要:Given an array of integers nums, write a method that returns the "pivot" index of this array. We define the pivot index as the index where the sum of
阅读全文
摘要:题目大意是实现一个类来管理图书,类的每个实例包含图书的start跟end属性(start<= x < end),确保每个实例的两个属性没有重叠范围。 很容易想到二叉排序树,将每个实例看成一个结点,有三种情况: 1.新插入结点的start大于P结点的end,则将新插入结点插入到P结点的右子树,P =
阅读全文

浙公网安备 33010602011771号