题目链接:https://leetcode.com/problems/delete-duplicate-emails/题目:
Write a SQL query to delete all duplicate email entries in a table named Person, keeping only unique emails based on its smallest Id.+—-+...
分类:
其他好文 时间:
2016-05-18 18:55:31
阅读次数:
151
来自《训练指南》优先级队列的例题。 题目链接:http://acm.hust.edu.cn/vjudge/problem/viewProblem.action?id=18702 题意:给定k个整数数组,各包含k个元素。在每个数组中取一个元素加起来,可以得到kk个和,求这些和中最小的k个值(不去重)。 ...
分类:
其他好文 时间:
2016-05-16 14:10:13
阅读次数:
158
原文地址:点击打开链接
(原题是英文,下面的是用有道翻译的)
描述
鉴于许多不同的小数位数,你可以通过选择一个非空的子集形成一个整数的位数和写一些秩序。剩下的数字可以写在一些秩序形成第二个整数。除非得到的整数是0,整数可能不会从数字0开始。
例如,如果您有数字0,1,2,4,6和7,您可以编写两个整数10和2467。当然,有很多方法可以形成这样的双整数:210年和764年,204年和176...
分类:
其他好文 时间:
2016-05-13 04:07:33
阅读次数:
204
abs写成fabs导致WA了一发。 关于next_permutation()这个STL里面的函数的基本应用 http://www.cnblogs.com/luosuo10/p/5479188.html ...
分类:
其他好文 时间:
2016-05-10 20:41:53
阅读次数:
127
Description
Dilworth is the world’s most prominent collector of Russian nested dolls: he literally has thousands of them! You know, the wooden hollow dolls of different sizes of which the smallest...
分类:
其他好文 时间:
2016-05-07 11:11:50
阅读次数:
140
18.6 Describe an algorithm to find the smallest one million numbers in one billion numbers. Assume that the computer memory can hold all one billion n ...
分类:
其他好文 时间:
2016-05-07 06:37:17
阅读次数:
177
Description Description You're given a list of n strings a1,?a2,?...,?an. You'd like to concatenate them together in some order such that the resultin ...
分类:
其他好文 时间:
2016-05-02 11:40:04
阅读次数:
184
题目链接:点击打开链接
思路:多路归并。 用贪心的规则, 我们先考虑两个数组的情况, 如果将两个数组从小到大排序, 那么我们先将数组a的所有元素加上数组b的最小的元素, 然后放入优先队列。 因为是事先排好序的, 所以其中肯定有一个是最小的,那么当这个数取出来之后, 如何保证队列头上时次小的呢? 我们发现, a数组的所有元素都用上了, 而且是和b数组中最小的数相加得到的, 所以, 当a[0]+b[...
分类:
其他好文 时间:
2016-04-29 16:18:04
阅读次数:
124
1. 问题描写叙述 给定一个二叉搜索树,找出第k小的元素。 注意:能够如果k总是存在,1≤k≤BST总元素数1 \le k \le BST总元素数。 2. 方法与思路 依据二叉搜索树的特点。中序遍历的结果即是排序好的数组。那么找出第k小的数,仅仅须要先进行一次中序遍历就可以。 /** * Defin ...
分类:
其他好文 时间:
2016-04-17 20:44:37
阅读次数:
148