![](https://img-blog.csdnimg.cn/20201014180756754.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
leetcode刷题
pkuxuan
pku研究生在读
展开
-
leetcode-524 最长子序列 C++
**524. Longest Word in Dictionary through DeletingMedium305165Favorite删除 s 中的一些字符,使得它构成字符串列表 d 中的一个字符串,找出能构成的最长字符串。如果有多个相同长度的结果,返回字典序的最小字符串。ShareGiven a string and a string dictionary, find the...原创 2019-03-29 15:16:39 · 730 阅读 · 0 评论 -
leetcode 215. Kth Largest Element in an Array最大k值
Find the kth largest element in an unsorted array. Note that it is the kth largest element in the sorted order, not the kth distinct element.Example 1:题目描述:找到第 k 大的元素。Input: [3,2,1,5,6,4] and k = 2...原创 2019-03-29 18:22:03 · 106 阅读 · 0 评论 -
最全详细分析,都能看懂,leetcode 347. Top K Frequent Elements出现频率最多的 k 个数
1:题目描述Given a non-empty array of integers, return the k most frequent elements.Example 1:Input: nums = [1,1,1,2,2,3], k = 2Output: [1,2]Example 2:Input: nums = [1], k = 1Output: [1]2:代码分析方案一:...原创 2019-03-30 15:49:29 · 361 阅读 · 0 评论 -
leetcode 42. Trapping Rain Water最大水域 收集雨水
Given n non-negative integers representing an elevation map where the width of each bar is 1, compute how much water it is able to trap after raining.The above elevation map is represented by array [...原创 2019-05-13 22:43:36 · 897 阅读 · 0 评论 -
中序遍历 94. Binary Tree Inorder Traversal
方法一:堆栈解决,不修改原节点 vector<int> inorderTraversal(TreeNode* root) { //堆栈解法 时间O(n) vector <int> res; TreeNode *curroot=root; stack<TreeNode *>s; wh...原创 2019-05-14 16:26:21 · 252 阅读 · 0 评论 -
排列 Leecode 46. Permutations
PermutationsMedium192257FavoriteShareGiven a collection of distinct integers, return all possible permutations.Example:Input: [1,2,3]Output:[[1,2,3],[1,3,2],[2,1,3],[2,3,1],[3,1,2],[...原创 2019-05-14 17:30:33 · 127 阅读 · 0 评论 -
78. Subsets leetcode
SubsetsMedium184549FavoriteShareGiven a set of distinct integers, nums, return all possible subsets (the power set).Note: The solution set must not contain duplicate subsets.Example:Input: ...原创 2019-05-15 15:05:33 · 140 阅读 · 0 评论