Problem Description
bobo has a sequence a1,a2,…,an. He is allowed to swap two
adjacent numbers for no more than k times.
Find the minimum number of inversions after his swaps.
Note: The number...
分类:
其他好文 时间:
2014-08-05 22:44:03
阅读次数:
248
Find the contiguous subarray within an array (containing at least one number) which has the largest sum.
For example, given the array [?2,1,?3,4,?1,2,1,?5,4],
the contiguous subarray [4,?1,2,1] ha...
分类:
其他好文 时间:
2014-08-05 22:37:50
阅读次数:
188
KMP查找整数数列,不是查找字符串。
原理是一样的,不过把字符串转换为数列,其他基本上是一样的。
#include
#include
const int MAX_N = 1000001;
const int MAX_M = 10001;
int strN[MAX_N], strM[MAX_M], next[MAX_M], N, M;
void getNext()
{
mems...
分类:
其他好文 时间:
2014-08-05 22:37:10
阅读次数:
194
Given an array of integers, every element appears three times except for one. Find that single one.
Note:
Your algorithm should have a linear runtime complexity. Could you implement it without u...
分类:
其他好文 时间:
2014-08-05 22:35:00
阅读次数:
277
转:http://blog.csdn.net/gzh0222/article/details/7711281使用java vuser实现,发送gzip压缩json格式。/* * LoadRunner Java script. (Build: _build_number_) * * Script D....
分类:
Web程序 时间:
2014-08-05 22:12:30
阅读次数:
311
多次看到DETERMINISTIC,一直很疑惑,今天做了一个实验。我们欺骗ORACLE说是一个DETERMINISTIC函数,它在SQL中只调用一次。如果不使用DETERMINISTIC,可以看到出来的值都不一样。使用DETERMINISTIC后,不同的会话都出来一样的值。
SQL> create or replace function f_t(i_p int) return number DE...
分类:
数据库 时间:
2014-08-05 19:26:30
阅读次数:
247
-- 查询连续3天登录的用户1 先创建一个表,如下:1 create table USER_DATA2 (3 USER_ID NUMBER,4 LOGIN_TIME DATE5 );2 插入用户登录数据: 1 insert into user_data (USER_ID, LOGIN_TIME) v...
分类:
数据库 时间:
2014-08-05 18:13:10
阅读次数:
420
Data Structures
1. Integer
– find number of 1s
– next largest smaller
– smallest larger number
– determine if is palindrom
– itoa, atoi
– add 2 numbers w/...
分类:
其他好文 时间:
2014-08-05 15:50:40
阅读次数:
408
Prime Palindrome GolfDo you know how to play Prime Palindrome Golf? You are given a number and your challenge is to find the closest palindromic prime...
分类:
其他好文 时间:
2014-08-05 13:24:49
阅读次数:
274
Description
You have N integers, A1,
A2, ... , AN. You need to deal with two kinds of operations. One type of operation is to add some given number to each number in a given interval.
The other ...
分类:
其他好文 时间:
2014-08-05 11:15:59
阅读次数:
243