Given a string S, count the number of distinct, non-empty subsequences of S . Since the result may be large, return the answer modulo 10^9 + 7. Exampl ...
分类:
其他好文 时间:
2020-03-18 09:38:23
阅读次数:
52
题目地址:https://leetcode-cn.com/problems/dui-lie-de-zui-da-zhi-lcof/ 题目描述 请定义一个队列并实现函数 max_value 得到队列里的最大值,要求函数max_value、push_back 和 pop_front 的均摊时间复杂度都是 ...
分类:
编程语言 时间:
2020-03-18 09:18:46
阅读次数:
69
1 class Solution 2 { 3 vector<vector<int>> res; 4 int sum = 0; 5 public: 6 void helper(vector<int>& nums, int start,int target, vector<int>& out) 7 { ...
分类:
其他好文 时间:
2020-03-17 23:55:47
阅读次数:
93
Q:假设你有一个数组,其中第i个元素是某只股票在第i天的价格。 如果你最多只能完成一笔交易(即买一股和卖一股股票),设计一个算法来求最大利润。 A:当前值比最小值小,代替最小值;当前值比最小值大,计算差值,和之前的差值做判断。 Q:假设你有一个数组,其中第i个元素表示某只股票在第i天的价格。 设计一 ...
分类:
其他好文 时间:
2020-03-15 22:02:24
阅读次数:
46
前言 比赛真的状态不好(腐了一小会),导致差点爆0。 这个题解真的是在非常非常专注下写出来的,要不然真的心态崩。 题目 题目描述 奶牛Bassie想要覆盖一大块广告牌,她在之前已经覆盖了一小部分广告牌(但覆盖的这块面积不一定在广告牌上) 现在她要取一块足够大的布来将剩下的部分覆盖,问至少要多大的矩形 ...
分类:
其他好文 时间:
2020-03-15 16:21:40
阅读次数:
60
1、给定两个数组,编写一个函数来计算它们的交集。 示例 1: 1 输入: nums1 = [1,2,2,1], nums2 = [2,2] 2 输出: [2,2] 示例 2: 1 输入: nums1 = [4,9,5], nums2 = [9,4,9,8,4] 2 输出: [4,9] 说明: 输出结 ...
分类:
编程语言 时间:
2020-03-15 13:23:58
阅读次数:
41
基本原理就不做介绍了, 很基础的数据结构课程知识.私下回顾即可,主要学习代码. 1.双指针 https://leetcode-cn.com/problems/two-sum-ii-input-array-is-sorted/description/?utm_source=LCUS&utm_mediu ...
分类:
编程语言 时间:
2020-03-15 13:20:39
阅读次数:
70
The next lecture in a high school requires two topics to be discussed. The ii-th topic is interesting by aiaiunits for the teacher and by bibi units f ...
分类:
其他好文 时间:
2020-03-14 23:59:09
阅读次数:
158
You are given some Tetris field consisting of nn columns. The initial height of the ii-th column of the field is aiai blocks. On top of these columns ...
分类:
其他好文 时间:
2020-03-14 23:53:35
阅读次数:
75
现在你总共有 n 门课需要选,记为 0 到 n-1。 在选修某些课程之前需要一些先修课程。 例如,想要学习课程 0 ,你需要先完成课程 1 ,我们用一个匹配来表示他们: [0,1] 给定课程总量以及它们的先决条件,返回你为了学完所有课程所安排的学习顺序。 可能会有多个正确的顺序,你只要返回一种就可以 ...
分类:
其他好文 时间:
2020-03-14 14:43:58
阅读次数:
48