算法题:
一个由若干个取值范围在【1,2^31-1】的整数构成的长度为N的数字序列,其中N<5000000;求该数字序列上一段最小的连续区间的长度,要求该区间内正好包含了该N个数字序列所有不同的数字,如果存在多个这样的区间,按照出现的顺序输出所有的区间骑士和结束位置,序列的位置编号从1到N,其中最小的区间长度不会超过10000。
输入:
10
1
1
3
4
6
6
5
1
3
3
输出:
6 ,3
[2,7] [3,8] [4,9]
解题思路:使用队列
#include<iostream>
#include<vector>
#include<map>
#include<queue>
#include<set>
using namespace std;
int main() {