类似于find kth small element in sorted matrix, 另外数组是个好东西,在构造heap 的元素的时候 Some observations: For every numbers in nums1, its best partner(yields min sum) a ...
分类:
其他好文 时间:
2017-11-07 23:59:26
阅读次数:
365
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. For exam ...
分类:
其他好文 时间:
2017-11-06 11:31:30
阅读次数:
147
class Solution { public: int findKthLargest(vector& nums, int k) { return findInner(nums, 0, nums.size()-1,k); } int findInner(vector& nums, int iLeft... ...
分类:
其他好文 时间:
2017-11-01 19:38:05
阅读次数:
155
T1 考试用treap水过了...我自己造的数据明明跑了12s (1)Treap 直接0~m个值全都塞进Treap里,然后就是插入和删除了 不要用new,要么重载new,要么开数组... (2)用队列和单调队列维护 维护一个cnt表示当前0~cnt卡车上都已经加入过(当前0~cnt的值并不一定在卡车 ...
分类:
其他好文 时间:
2017-10-29 21:57:39
阅读次数:
202
Question: Find the kth largest element in an unsorted array. Note that it is the kth largest element inthe sorted order, not the kth distinct element. ...
分类:
编程语言 时间:
2017-10-27 01:38:55
阅读次数:
216
在spring + springmvc + mybatis框架中,我们配置接口对外返回json格式,但是报如下错误: 经过度娘,因为springmvc默认是没有对象转换成json的转换器的,需要手动添加jackson依赖。 因此,在build.gradle中加入: 如果maven,加入: 手动添加j ...
分类:
编程语言 时间:
2017-10-24 20:49:12
阅读次数:
684
Given a n x n matrix where each of the rows and columns are sorted in ascending order, find the kth smallest element in the matrix. Note that it is th ...
分类:
其他好文 时间:
2017-10-24 16:07:33
阅读次数:
100
一、Zookeeper的四字命令Zookeeper支持某些特定的四字命令字母与其的交互。他们大多数是查询命令,用来获取Zookeeper服务的当前状态及相关信息。用户在客户端可以通过telnet或nc向Zookeeper提交相应的命令。Zookeeper常用的四字命令见下图所示。上图,是Zookee... ...
分类:
其他好文 时间:
2017-10-24 14:51:32
阅读次数:
118
Description: Given an index k, return the kth row of the Pascal's triangle. For example, given k = 3,Return [1,3,3,1]. Note:Could you optimize your al ...
分类:
其他好文 时间:
2017-10-16 23:26:43
阅读次数:
224
两个有序的数组 nums1 和 nums2 维数分别为m,n。找所有数的中位数,复杂度 O(log (m+n)) 注意:奇偶个数,分治法求解,递归出口特殊处理。取Kth smallest数时,分治取mid=k/2和k-mid,避免奇数造成影响。 ...
分类:
其他好文 时间:
2017-10-09 19:34:58
阅读次数:
147