摘要: 数的范围 给定一个升序数组和一个值, 找出这个值在数组中出现的起始和终止位置,如果不存在,返回-1 -1 分析 假定数组长度是n, 整数是target 首先找出起始位置,即找出满足条件的左边界,以以下数组为例 1 2 3 3 3 3 4 target = 3 左边界右边的数据显然满足>= targe 阅读全文
posted @ 2023-06-28 11:47 INnoVation-V2 阅读(45) 评论(0) 推荐(0) 编辑
摘要: 归并排序-逆序对的数量 原理 略 代码 #include<iostream> using namespace std; const int N = 1e5 + 10; typedef unsigned long long ULL; int s[N], tmp[N]; ULL mergeSort(in 阅读全文
posted @ 2023-06-28 11:25 INnoVation-V2 阅读(4) 评论(0) 推荐(0) 编辑