
LeetCode每日一题
Egqawkq
北航CS研一在读
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
LeetCode115. Distinct Subsequences
Given a stringSand a stringT, count the number of distinct subsequences ofSwhich equalsT. A subsequence of a string is a new string which is formed from the original string by deleting some (ca...原创 2019-04-03 22:12:02 · 238 阅读 · 0 评论 -
LeetCode87. Scramble String(递推、剪枝)(每日一题——2019.3.31)
题意:给一二叉树,对于非叶子节点可以交换左右孩子结点,从而形成了新的树,继而每个结点代表的字符串打乱顺序,问你给你两个字符串s1与s2,问s2是否可以由s1做上述操作得到。 Below is one possible representation ofs1="great": great / \ gr eat / \ / \ g r e ...原创 2019-03-31 10:50:27 · 268 阅读 · 0 评论 -
LeetCode 123. Best Time to Buy and Sell Stock III
123.Best Time to Buy and Sell Stock III Say you have an array for which theithelement is the price of a given stock on dayi. Design an algorithm to find the maximum profit. You may complete at m...转载 2019-04-07 00:29:06 · 259 阅读 · 0 评论 -
LeetCode97. Interleaving String(DP)
其实这种两个字符串的操作题比较多,很多都是可以借助DP解决的,比较经典的题就比如:距离编辑 废话不多,dp[i][j]定义为s1的前i项以及s2前j项共同交叉组成了s3的前i+j项的可能性,只有满足组成条件时次可以设dp[i][j]=true 转移方程: i!=0&&j!=0: dp[i][j]=(dp[i-1][j]&&(s1[i-1]==s3[i+j-1]...原创 2019-04-01 21:51:45 · 245 阅读 · 0 评论 -
LeetCode99—Recover Binary Search Tree
class Solution { private: void helper(TreeNode*root, TreeNode*&pre, vector<TreeNode*>&res) { if (root == NULL) return; helper(root->left, pre, res...转载 2019-04-02 16:50:50 · 206 阅读 · 0 评论 -
日常切LeetCode水题?(Python)
135.Candy # Share # There are N children standing in a line. Each child is assigned a rating value. # # You are giving candies to these children subjected to the following requirements: # # Each c...原创 2019-07-18 10:03:16 · 229 阅读 · 0 评论