leetcode
philpanic9
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
LeetCode 4. Median of Two Sorted Arrays
There are two sorted arrays nums1 and nums2 of size m and n respectively.Find the median of the two sorted arrays. The overall run time complexity should be O(log (m+n)).You may assume nums1 and num...原创 2020-03-02 09:17:30 · 129 阅读 · 0 评论 -
LeetCode 995. Minimum Number of K Consecutive Bit Flips
In an array A containing only 0s and 1s, a K-bit flip consists of choosing a (contiguous) subarray of length K and simultaneously changing every 0 in the subarray to 1, and every 1 in the subarray to ...原创 2020-01-09 16:42:17 · 210 阅读 · 0 评论 -
Leetcode 274. H-Index & Round H H-index-Kick Start 2019
Given an array of citations (each citation is a non-negative integer) of a researcher, write a function to compute the researcher’s h-index.According to the definition of h-index on Wikipedia: “A sci...原创 2020-01-04 13:40:53 · 274 阅读 · 0 评论 -
LeetCode 1234. Replace the Substring for Balanced String
You are given a string containing only 4 kinds of characters ‘Q’, ‘W’, ‘E’ and ‘R’.A string is said to be balanced if each of its characters appears n/4 times where n is the length of the string.Ret...原创 2019-10-20 17:54:06 · 455 阅读 · 0 评论 -
LeetCode 207. Course Schedule 拓扑排序
拓扑排序的经典应用。将课程看作图中的节点,先修关系看作边,由先修课指向后修课,则问题抽象为一个图的节点的拓扑排序问题。我的这篇博客中介绍了对于无环图如何进行拓扑排序。代码class Solution {public: bool canFinish(int numCourses, vector<pair<int, int>>& pres) { ...原创 2019-08-03 09:04:30 · 224 阅读 · 0 评论 -
LeetCode 144,94,145 迭代法实现二叉树的先序,中序,后序遍历
Leetcode 先序,中序,后序遍历的题目链接:144. Binary Tree Preorder Traversal94. Binary Tree Inorder Traversal145. Binary Tree Postorder Traversal1. 简要介绍一下先序,中序,后序遍历的区别:例如下面这棵树:它的遍历结果如下:先序:8 3 1 6 4 7 10 14 13...原创 2019-06-23 12:41:53 · 192 阅读 · 0 评论 -
LeetCode 45. Jump Game II
Given an array of non-negative integers, you are initially positioned at the first index of the array.Each element in the array represents your maximum jump length at that position.Your goal is to r...原创 2019-06-08 15:44:44 · 122 阅读 · 0 评论 -
LeetCode 97. Interleaving String 递归/DP
Given s1, s2, s3, find whether s3 is formed by the interleaving of s1 and s2.Example 1:Input: s1 = “aabcc”, s2 = “dbbca”, s3 = “aadbbcbcac”Output: trueExample 2:Input: s1 = “aabcc”, s2 = “dbbc...原创 2019-05-20 18:19:03 · 161 阅读 · 0 评论 -
LeetCode 22. Generate Parentheses dp
Given n pairs of parentheses, write a function to generate all combinations of well-formed parentheses.For example, given n = 3, a solution set is:[“((()))”,“(()())”,“(())()”,“()(())”,“()()()”...原创 2019-03-15 21:34:01 · 197 阅读 · 0 评论 -
LeetCode 784. Letter Case Permutation
原题链接Given a string S, we can transform every letter individually to be lowercase or uppercase to create another string. Return a list of all possible strings we could create.Examples:Input: S ...原创 2018-10-02 15:06:01 · 144 阅读 · 0 评论
分享