集合的定义: 有不同元素组成 无序 集合中元素必须是不可变类型 创建集合 集合的内置方法 1、add 2、clear 3、pop 4、remove(指定删除,删除元素不存在会报错) 5、discard 6、intersection 7、union 8、difference 9、symmetric_d ...
分类:
其他好文 时间:
2018-02-10 15:55:32
阅读次数:
148
集合set(集合)是一个无需不重复的元素数据集,对比列表的区别首先是无需的,不可以使用索引进行访问,另外一个特点是不能有重复数据。项目开发中,集合主要用于数据元素去重和测试是否存在。集合还支持一些数学上的运算,例如:union(联合)、intersection(交)、difference(差)、symmetricdifference(对称差集)。创建集合:集合使用大括号或者set函数创建,需要注意
分类:
编程语言 时间:
2018-02-09 15:38:13
阅读次数:
191
Implement a stack with min() function, which will return the smallest number in the stack. It should support push, pop and min operation all in O(1) c ...
分类:
其他好文 时间:
2018-02-04 13:56:09
阅读次数:
144
下载了一个arm的gcc编译器遇到编译错误 https://stackoverflow.com/questions/13797693/what-is-the-difference-between-arm-linux-gcc-and-arm-none-linux-gnueabi/13798214 To ...
分类:
其他好文 时间:
2018-02-02 23:19:00
阅读次数:
363
Nearly every one have used the Multiplication Table. But could you find out the k-th smallest number quickly from the multiplication table? Given the ...
分类:
其他好文 时间:
2018-01-28 00:07:54
阅读次数:
183
Given a binary search tree, write a function kthSmallest to find the kth smallest element in it. Note: You may assume k is always valid, 1 ≤ k ≤ BST's ...
分类:
其他好文 时间:
2018-01-24 22:11:50
阅读次数:
118
A sequence of number is called arithmetic if it consists of at least three elements and if the difference between any two consecutive elements is the ...
分类:
其他好文 时间:
2018-01-21 13:41:28
阅读次数:
113
版本1: 版本2: 算法 adjacent_difference 用来计算 [first,last)中相邻元素的差额。也就是说,它将 *first 赋值给 *result,并针对 [first+1,last) 内1每个元素的迭代器 i ,将 *i - * ( i - 1 ) 的值赋值给 *( res ...
分类:
其他好文 时间:
2018-01-21 12:37:37
阅读次数:
192
Write a SQL query to delete all duplicate email entries in a table named Person, keeping only unique emails based on its smallest Id. For example, aft ...
分类:
其他好文 时间:
2018-01-20 18:57:22
阅读次数:
172
[抄题]: 在一个排序矩阵中找从小到大的第 k 个整数。 排序矩阵的定义为:每一行递增,每一列也递增。 [思维问题]: 不知道应该怎么加,因为不是一维单调的。 [一句话思路]: 取出一个头,加周围的一堆。 [输入量]:空: 正常情况:特大:特小:程序里处理到的特殊情况:异常情况(不合法不合理的输入) ...
分类:
编程语言 时间:
2018-01-19 14:07:02
阅读次数:
249