Given an unsorted integer array, find the first missing positive integer.For example,Given[1,2,0]return3,and[3,4,-1,1]return2.Your algorithm should ru...
分类:
其他好文 时间:
2014-07-22 22:52:33
阅读次数:
166
创建表: hive> CREATE TABLE pokes (foo INT, bar STRING); Creates a table called pokes with two columns, the first being an integer and the other a string....
分类:
其他好文 时间:
2014-07-22 22:50:54
阅读次数:
262
Jzzhu has invented a kind of sequences, they meet the following property:
You are given x and y,
please calculate fn modulo 1000000007 (109?+?7).
Input
The first line contains two int...
分类:
其他好文 时间:
2014-07-22 22:49:33
阅读次数:
296
他妹的,敲完了,电脑死机了,全部消失了,又从新打了一遍,。。。这是什么节奏#include
#include
#include
#define ZERO 0
#define ALPH_LEN 26 /* 26个字母 */
const char FIRST_CHAR = 'a';
typedef struct node
{
struct node *child[ALPH_LEN]; ...
分类:
其他好文 时间:
2014-07-20 00:31:16
阅读次数:
286
search_n
----------------------------------------------------------------------------------------
描述:在序列[first, last) 所涵盖的区间中,查找"连续 count 个符合条件之元素"所形成的子序列,
并返回迭代器 last
思路:
1.首先找出 value 第一次出现点
2.该出现点的后面是否连续出现 count - 1 个 value
3.如果是,找到了,如果不是,在当前元素后的区间重新找...
分类:
其他好文 时间:
2014-07-19 23:31:25
阅读次数:
355
next_permutation
-----------------------------------------------------------------------
描述: 取得 [first, last) 所标示之序列的下一个排列组合。如果没有,返回 false,有,返回true
思路:
从后往前
1.找两个相邻元素,令左端的元素为*i,右端的元素为*ii,且满足 *i < *ii
2.找出第一个大于 *i 的元素,令其为 *j,将*i,*j元素对调
3.将ii右端的所有元素颠倒
源码:
t...
分类:
其他好文 时间:
2014-07-19 23:29:37
阅读次数:
383
样题简易的意思就是N盏灯,K个人去关。第K个人只会按下和K成倍数的开关,最后问那几盏灯开着。题目不难,但是代码里一些技巧很好:#includemain(){int n,i,k,j,m,first=1;int a[1008]={0};scanf("%d%d",&m,&n);for(i=1;i<=n;i...
分类:
其他好文 时间:
2014-07-19 19:01:48
阅读次数:
167
http://blog.csdn.net/sunquana/article/details/9153213一、 fill和fill_n函数的应用: fill函数的作用是:将一个区间的元素都赋予val值。 函数参数:fill(first,last,val);//first为容器的首迭代器,last为....
分类:
编程语言 时间:
2014-07-19 14:22:17
阅读次数:
219
JS数组定义收藏数组有四种定义的方式 使用构造函数: var a = new Array(); var b = new Array(8); var c = new Array("first", "second", "third"); 或者数组直接量: var d = ["first", "secon...
分类:
Web程序 时间:
2014-07-19 13:37:15
阅读次数:
289