发现提交记录全用的是nth_element...(真就STL依赖症?) 提供一种 \(\mathcal O(n)\) 的分治算法。 Solution 我们可以用类似快排的方式。在快排的分治中,若双指针(\(i,j\))已经扫描完这段区间 \([l,r]\),即 \(i\) 已经大于 \(j\),就会 ...
分类:
其他好文 时间:
2020-12-08 12:34:42
阅读次数:
6
###题目 1200. Minimum Absolute Difference ###解题方法 先对arr排序,再遍历arr,将其中的数存入字典作为键,并且计算最小差值mindif。最后遍历字典中的键key,如果key+mindif也在字典中,则加入到返回值rat。 时间复杂度:O(nlogn) 空 ...
分类:
其他好文 时间:
2020-11-27 11:43:44
阅读次数:
10
SHA1 VS RSA: what's the difference between them? Fundamentally different. SHA1 is a hash algorithm, which is a one way function, turning an input of a ...
分类:
其他好文 时间:
2020-11-23 12:09:41
阅读次数:
4
Given an array of integers nums and an integer threshold, we will choose a positive integer divisor and divide all the array by it and sum the result ...
分类:
其他好文 时间:
2020-11-13 13:21:44
阅读次数:
33
You are given a sorted unique integer array nums. Return the smallest sorted list of ranges that cover all the numbers in the array exactly. That is, ...
分类:
其他好文 时间:
2020-10-30 11:55:20
阅读次数:
20
题目如下: Given an array nums, you are allowed to choose one element of nums and change it by any value in one move. Return the minimum difference between ...
分类:
其他好文 时间:
2020-09-17 22:48:12
阅读次数:
35
There are two variants of SQL statement execution defined in SAP note 2000002 – FAQ: SAP HANA SQL Optimization. The difference is how the where condit ...
分类:
数据库 时间:
2020-09-15 20:58:55
阅读次数:
57
题目地址:632. 最小区间 You have k lists of sorted integers in ascending order. Find the smallest range that includes at least one number from each of the k li ...
分类:
其他好文 时间:
2020-08-26 17:10:59
阅读次数:
46
1.写在前面 在开始之前,说明一下该篇中重点在union、intersection、difference、filter的实现,对于Sets类中的其他方法如newHashSet、newConcurrentHashSet、newLinkedHashSet等方法等见名知意,不做介绍。 2.阅读内容 col ...
分类:
其他好文 时间:
2020-08-06 13:14:27
阅读次数:
75