题目 给定一个整数数组,其中第 i 个元素代表了第 i 天的股票价格 。? 设计一个算法计算出最大利润。在满足以下约束条件下,你可以尽可能地完成更多的交易(多次买卖一支股票): 你不能同时参与多笔交易(你必须在再次购买前出售掉之前的股票)。卖出股票后,你无法在第二天买入股票 (即冷冻期为 1 天)。 ...
分类:
其他好文 时间:
2020-07-10 21:10:35
阅读次数:
73
题目 Given two binary strings, return their sum (also a binary string). The input strings are both non-empty and contains only characters 1 or 0. Exampl ...
分类:
其他好文 时间:
2020-07-10 20:58:33
阅读次数:
56
题目描述 给定一个非负整数 numRows,生成杨辉三角的前 numRows 行。 示例: 输入: 5 输出: [ [1], [1,1], [1,2,1], [1,3,3,1], [1,4,6,4,1] ] 题目链接: https://leetcode-cn.com/problems/pascals ...
分类:
其他好文 时间:
2020-07-10 17:20:39
阅读次数:
72
题目: 请实现 copyRandomList 函数,复制一个复杂链表。在复杂链表中,每个节点除了有一个 next 指针指向下一个节点,还有一个 random 指针指向链表中的任意节点或者 null。 来源:力扣(LeetCode)链接:https://leetcode-cn.com/problems ...
分类:
编程语言 时间:
2020-07-10 16:54:08
阅读次数:
62
LC148 two-sum 题意:数组中找出两个加起来等于目标值的数 题解:unordered存值对应下标,注意相同数的特判 LC147 median-of-two-sorted-arrays 题意:两个有序数组中位数 题解:Kth(A,m,B,n,k),若m>n交换,pa=min(k/2,m),p ...
分类:
其他好文 时间:
2020-07-10 15:23:31
阅读次数:
60
A string S of lowercase English letters is given. We want to partition this string into as many parts as possible so that each letter appears in at mo ...
分类:
其他好文 时间:
2020-07-10 13:24:07
阅读次数:
65
354. 俄罗斯套娃信封问题 描述: 思路:先按照第一个维度排序,第一维度相同时,第二维度降序。然后对第二维度进行最长上升子序列。(第二维度降序是为了避免同长度下的嵌套) 355. 设计推特 描述: 思路:通过一个map来维护一个用户发的推文。(推文对象之间用链表连接)。然后用一个优先队列得出10个 ...
分类:
其他好文 时间:
2020-07-10 12:59:48
阅读次数:
79
Find all possible combinations of k numbers that add up to a number n, given that only numbers from 1 to 9 can be used and each combination should be ...
分类:
其他好文 时间:
2020-07-10 09:59:09
阅读次数:
61
Given a positive integer a, find the smallest positive integer b whose multiplication of each digit equals to a. If there is no answer or the answer i ...
分类:
其他好文 时间:
2020-07-10 09:57:57
阅读次数:
79
Given a binary tree, write a function to get the maximum width of the given tree. The width of a tree is the maximum width among all levels. The binar ...
分类:
其他好文 时间:
2020-07-10 09:54:38
阅读次数:
54