Question: 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 tha ...
分类:
其他好文 时间:
2018-03-09 12:13:59
阅读次数:
164
题目:http://poj.org/problem?id=2718 题意: 就是输入N组数据,一组数据为,类似 【1 4 5 6 8 9】这样在0~9之间升序输入的数据,然后从这些数据中切一刀,比如 n1:【1 4 5】,n2:【6 8 9】这样,然后 abs(n1- n2),对n1 和 n2的所有 ...
分类:
其他好文 时间:
2018-03-05 20:41:59
阅读次数:
194
【链接】 "我是链接,点我呀:)" 【题意】 在这里输入题意 【题解】 尺取法。 考虑一个1..i的窗口。 里面在到达了i位置的时候恰好有1..k这些数字了。 为了更接近答案。 显然可以试着让左端点变成2.(如果还能有1..k这些数字的话。 所以有1..k这些数字之后。就让左端点尽可能往右。 然后尝 ...
分类:
其他好文 时间:
2018-02-20 20:21:00
阅读次数:
158
Given a start IP address ip and a number of ips we need to cover n, return a representation of the range as a list (of smallest possible length) of CI ...
分类:
其他好文 时间:
2018-02-11 10:43:16
阅读次数:
257
Implement a stack with min() function, which will return the smallest number in the stack. It should support push, pop and min operation all in O(1) c ...
分类:
其他好文 时间:
2018-02-04 13:56:09
阅读次数:
144
一些经典的编程题 连续最大子数组 c++ include using namespace std; / get the index of max sum sub array and the sum @param arr the given array @param low the lowwer bo ...
分类:
其他好文 时间:
2018-01-29 00:22:29
阅读次数:
159
Nearly every one have used the Multiplication Table. But could you find out the k-th smallest number quickly from the multiplication table? Given the ...
分类:
其他好文 时间:
2018-01-28 00:07:54
阅读次数:
183
Given a binary search tree, write a function kthSmallest to find the kth smallest element in it. Note: You may assume k is always valid, 1 ≤ k ≤ BST's ...
分类:
其他好文 时间:
2018-01-24 22:11:50
阅读次数:
118
Write a SQL query to delete all duplicate email entries in a table named Person, keeping only unique emails based on its smallest Id. For example, aft ...
分类:
其他好文 时间:
2018-01-20 18:57:22
阅读次数:
172
[抄题]: 在一个排序矩阵中找从小到大的第 k 个整数。 排序矩阵的定义为:每一行递增,每一列也递增。 [思维问题]: 不知道应该怎么加,因为不是一维单调的。 [一句话思路]: 取出一个头,加周围的一堆。 [输入量]:空: 正常情况:特大:特小:程序里处理到的特殊情况:异常情况(不合法不合理的输入) ...
分类:
编程语言 时间:
2018-01-19 14:07:02
阅读次数:
249