转自 一、函数sort() sort() :仅对list对象进行排序,会改变list自身的顺序,没有返回值,即原地排序; list.sort(key=None, reverse=False) key :设置排序方法,或指定list中用于排序的元素; reverse :升降序排列,默认为升序排列; 一 ...
分类:
编程语言 时间:
2020-03-30 21:33:52
阅读次数:
92
Problem : Find the kth largest element in an unsorted array. Note that it is the kth largest element in the sorted order, not the kth distinct element ...
分类:
其他好文 时间:
2020-03-30 16:41:09
阅读次数:
69
一、map() import pandas as pd import numpy as np df = pd.DataFrame({'key1' : ['a', 'a', 'b', 'b', 'a'], 'key2' : ['one', 'two', 'one', 'two', 'one'], 'd ...
分类:
移动开发 时间:
2020-03-30 13:15:36
阅读次数:
97
两个数组的交集。题目即是题意,例子, Example 1: Input: nums1 = [1,2,2,1], nums2 = [2,2] Output: [2] Example 2: Input: nums1 = [4,9,5], nums2 = [9,4,9,8,4] Output: [9,4] ...
分类:
其他好文 时间:
2020-03-30 09:31:09
阅读次数:
62
"Collection 体系的三个核心约定" "Sorted & Navigable" "Iterator & Iterable" "Java 中的数组" "ArrayList" "LinkedList" "HashMap" "LinkedHashMap" "TreeMap" "HashSet/Li ...
分类:
其他好文 时间:
2020-03-30 09:20:07
阅读次数:
83
Given an array of integers and an integer k, find out whether there are two distinct indices i and j in the array such that nums[i] = nums[j] and the ...
分类:
其他好文 时间:
2020-03-29 21:16:05
阅读次数:
58
There are a number of spherical balloons spread in two-dimensional space. For each balloon, provided input is the start and end coordinates of the hor ...
分类:
其他好文 时间:
2020-03-29 12:34:44
阅读次数:
57
The next lecture in a high school requires two topics to be discussed. The ii -th topic is interesting by aiai units for the teacher and by bibi units ...
分类:
其他好文 时间:
2020-03-29 01:44:16
阅读次数:
280
? 先考虑如何判断一个询问集是否合法。 考虑询问一次$[l,r]$,能把$[1,l 1]∪[r+1,n]$和$[l,r]$区分开来。 现在定义一个块为一个没有被区分开极大的点集合。 当所有块的大小都是1的时候,这个方案就是合法。 ? 性质: 1.一个块是由若干连续段组成,比如下面这样: 111223 ...
分类:
其他好文 时间:
2020-03-28 23:33:05
阅读次数:
84
题目描述查看:https://leetcode-cn.com/problems/find-first-and-last-position-of-element-in-sorted-array/ 题目的意思是从一个有序的数组中,查找一个数,但是这个数是重复存在的,返回区间。题目要求的时间复杂度O(lo ...
分类:
编程语言 时间:
2020-03-28 21:42:00
阅读次数:
72