在剑指offer第2版"面试题39:数组中出现次数超过一半的数字"的题解中,有这么一句话: "我们有成熟的时间复杂度为O(n)的算法得到数组中任意第k大的数字", 我觉得这句话有点不妥,至少让我产生过误解。 go代码如下: func partition(nums []int, l, r int) i ...
分类:
编程语言 时间:
2020-01-04 14:36:08
阅读次数:
91
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 ...
分类:
其他好文 时间:
2020-01-03 21:27:13
阅读次数:
104
题目描述 给定一棵二叉搜索树,请找出其中的第k小的结点。例如, (5,3,7,2,4,6,8) 中,按结点数值大小顺序第三小结点的值为4。 思路:中序遍历 1 class Solution: 2 # 返回对应节点TreeNode 3 def KthNode(self, pRoot, k): 4 # ...
分类:
编程语言 时间:
2019-12-31 23:10:27
阅读次数:
62
Given a 2D binary matrix filled with 0's and 1's, find the largest square containing only 1's and return its area. Example: Input: 1 0 1 0 0 1 0 1 1 1 ...
分类:
其他好文 时间:
2019-12-27 13:47:34
阅读次数:
76
1.什么是服务 2.创建服务 1.创建一个rc控制器,启动三个pod,暴露容器端口8080 2.创建一个服务 创建的服务会根据selector标签来选择pod,凡是pod标签和服务标签匹配的都属于同一个服务,上面服务会占用80端口,服务会将链接转发到容器的8080端口 3.检测新服务 4.检测服务是 ...
分类:
其他好文 时间:
2019-12-24 09:47:53
阅读次数:
128
Description Given a board which is a 2D matrix includes a-z and dictionary dict, find the largest collection of words on the board, the words can not ...
分类:
其他好文 时间:
2019-12-22 00:39:36
阅读次数:
70
Description Find the contiguous subarray within an array (containing at least one number) which has the largest product. Description Description Find ...
分类:
其他好文 时间:
2019-12-21 22:54:06
阅读次数:
97
Description Description Given a 2D binary matrix filled with 0's and 1's, find the largest square containing all 1's and return its area. Example Exam ...
分类:
其他好文 时间:
2019-12-21 22:34:38
阅读次数:
87
Description Description Given a 2D binary matrix filled with 0's and 1's, find the largest square which diagonal is all 1 and others is 0. Only consid ...
分类:
其他好文 时间:
2019-12-21 22:24:34
阅读次数:
67
Description Description Given an array of integers, find a contiguous subarray which has the largest sum. The subarray should contain at least one num ...
分类:
其他好文 时间:
2019-12-21 22:17:06
阅读次数:
99