- 博客(4)
- 收藏
- 关注
原创 FindKthLargest
文章目录找到第K大的数思路实现 找到第K大的数 思路 在这里我主要用了快速排序的思想,但是效率高的前提是尽量确保原数组的无序和随机性。否则快速排序的复杂度会提高到O(n^2) 输入: [3,2,1,5,6,4] 和 k = 2 输出: 5 Set the startIndex = 0 and the endIndex = nums.size()-1; 因为我们假设了快速排序是ascending ...
2020-02-07 16:22:37 537
原创 链表问题全解(补充待续)
文章目录删除倒数第Nth节点SpecificationImplementation翻转单项链表RequirementImplementation (#1)Implementation (#2)反转双向链表RequirementImplementation反转部分单项链表Requirement解题思路Implementation合并两个有序链表解题思路Implementation 删除倒数第Nth节...
2020-01-17 20:21:06 275
原创 LeetCode #18 fourSum C++
文章目录#18 FourSum leetCode具体实现(C++) #18 FourSum leetCode 解决完三个数字之和,发现又来一个四个数字的和,真的服LeetCode. 这是用C++实现的执行结果,还不错。主要模仿三数之和的写法。感觉没有什么特别好的方法。首先排序然后用双指针。 具体实现(C++) class Solution { public: vector<vect...
2020-01-16 16:53:45 162
原创 ThreeSumCloest question
ThreeSumCloest question Introduction Given an array nums of n integers and an integer target, find three integers in nums such that the sum is closest to target. Return the sum of the three integers. ...
2020-01-07 18:32:20 115
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人